Skip to content

๐Ÿผ๐ŸผA Distributed Caching Service in Rust ๐Ÿฆ€๐Ÿฆ€

License

Notifications You must be signed in to change notification settings

jiisanda/pandas-pouch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

59 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

banner

๐Ÿผ pandas-pouch ๐Ÿผ

A Distributed Caching Service with Rust ๐Ÿฆ€๐Ÿฆ€.

Progress

  • โœ… Basic Cache
  • โœ… LRU Cache
  • โœ… Database Setup
  • โœ… API Integration
  • โœ… Docker Setup
  • ๐ŸŸก Consistent Hashing
  • ๐ŸŸก Distributed Cache - Dedicated cache cluster

Pre-requisites

How can pandas-pouch be used with current features?

Configuration

Create a config directory. And add default.toml file with the following configuration. Sample default.toml file is provided in the config directory config/sample_default.toml. Also add a .env file with the configuration in config/.env.sample file.

Running the Service

  1. Clone the repository and navigate to the project directory.
git clone https://github.com/jiisanda/pandas-pouch.git
cd pandas-pouch
  1. Start the service using docker-compose.
docker-compose build
docker-compose up

Interacting with the Service

You can use grpcurl to interact with the service. Install grpcurl using the installation guide in the grpcurl repository

Run the following command to interact with the service.

  1. Put operation
grpcurl -plaintext -proto proto/pandas_pouch.proto -d '{"key": "key2", "value": "value2"}' 0.0.0.0:50051 pandas_pouch.PandasPouchCacheService/Put
  1. Get Operation
grpcurl -plaintext -proto proto/pandas_pouch.proto -d '{"key": "key2"}' 0.0.0.0:50051 pandas_pouch.PandasPouchCacheService/Get
  1. PrintAll Operation
grpcurl -plaintext -proto proto/pandas_pouch.proto 0.0.0.0:50051 pandas_pouch.PandasPouchCacheService/PrintAll

pandas-pouch as a crate

To use pandas-pouch as a crate, add the following to your Cargo.toml file.

[dependencies]
pandas-pouch = { git = "https://github.com/jiisanda/pandas-pouch.git" }

Using it in code:

use pandas_pouch::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let mut client = Client::new("http://localhost:50051").await?;
  
  // put a value
  client.put("key1".to_string(), "value1".to_string()).await?;
  
  // get a value
  let value = client.get("key1".to_string()).await?;
  println!("Value: {:?}", value);
  
  Ok(())
}

License

This project is licensed under the MIT License.