Skip to content

rRateLimit/rcache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rcache

Fast and simple in-memory cache tool

Overview

rcache is a command-line based key-value cache tool with TTL (Time To Live) support. Implemented in Go, it provides fast and concurrency-safe operations.

Features

  • 🚀 Fast in-memory cache
  • ⏱️ TTL (Time To Live) support
  • 🔒 Concurrency-safe operations
  • 📝 Simple CLI interface
  • 🧪 Comprehensive test coverage

Installation

Build from source

git clone https://github.com/rRateLimit/rcache.git
cd rcache
make build

Install using Go

go install github.com/rRateLimit/rcache/cmd/rcache@latest

Usage

Basic Commands

Set a key-value pair

# Basic set
rcache set mykey "Hello, World!"

# Set with TTL (expires after 10 seconds)
rcache set mykey "Hello, World!" --ttl 10s

# TTL can be specified in seconds (s), minutes (m), or hours (h)
rcache set mykey "Hello, World!" --ttl 5m
rcache set mykey "Hello, World!" --ttl 1h

Get a value

rcache get mykey
# Output: Hello, World!

Delete a key

rcache delete mykey
# Output: Deleted: mykey

List all keys

rcache list

# Output as JSON
rcache list --json

Check cache size

rcache size
# Output: Cache size: 3

Clear cache

rcache clear
# Output: Cache cleared

Development

Requirements

  • Go 1.21 or higher

Build

make build

Run tests

make test

Format code

make fmt

Run all tasks

make all

Project Structure

rcache/
├── cmd/
│   └── rcache/
│       └── main.go          # Main entry point
├── internal/
│   ├── cache/
│   │   ├── cache.go         # Cache core implementation
│   │   └── cache_test.go    # Cache tests
│   └── cli/
│       ├── commands.go      # CLI command implementation
│       └── commands_test.go # CLI tests
├── go.mod
├── go.sum
├── Makefile
└── README.md

License

MIT License

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Author

rRateLimit

About

Fast and simple in-memory cache tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published