Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dafox/htcache
Simple and fast cache service with HTTP interface
https://github.com/dafox/htcache
clap-rs rust rust-lang warp-rs
Last synced: 22 days ago
JSON representation
Simple and fast cache service with HTTP interface
- Host: GitHub
- URL: https://github.com/dafox/htcache
- Owner: DaFox
- Created: 2023-03-05T20:41:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-05T21:18:17.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T02:59:06.938Z (9 months ago)
- Topics: clap-rs, rust, rust-lang, warp-rs
- Language: Rust
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HTCache - Simple and fast cache with HTTP interface
[![Rust](https://github.com/DaFox/htcache/actions/workflows/rust.yml/badge.svg)](https://github.com/DaFox/htcache/actions/workflows/rust.yml)
## Starting the service
```sh
htcache -a 0.0.0.0 -p 9000
```## Usage
### Write data to the cache
```
PUT /
Content-Type:
X-TTL:
``````sh
curl -XPUT http://localhost:3030/test --header "Content-Type: text/plain" --header "X-TTL: 120" --data-binary="hello world"
```### Read data from the cache
```
GET /
``````sh
curl -XGET http://localhost:3030/test
```## About this demo
This demo application uses the following techniques and libraries:
* "Warp" for creating an lightweight HTTP server with REST interface
* "Clap" for creating a nice command line interface
* "Tokio" to run the garbage collector asynchronous
* "Serde" and "Serde JSON" to serialize and deserialize the cache