Gedis - Redis-compatible Cache Server
A high-performance in-memory caching solution written in Go
Features • Architecture • Installation • Quick Start • Commands • Client
Gedis is a lightweight, in-memory key-value store server that implements the RESP (REdis Serialization Protocol) specification. It provides a simple and efficient way to store and retrieve data over TCP connections. Built with Go, it offers high performance and concurrent connection handling while maintaining a simple and intuitive API
✅ Redis Protocol Compatible - Works with existing Redis clients
✅ Performant - Written in Go for high concurrency and speed
✅ Comprehensive Data Structure Support:
- Key-value strings
- Lists for queue/stack operations
- Sets for unique collections
- Hashes for structured data
- Sorted sets for priority queues
✅ Key Expiration - TTL support for automatic cache invalidation
✅ Atomic Operations - Increment/decrement and other atomic commands
✅ Key Watching - Monitor changes for transaction safety
Gedis follows a simple client-server architecture:
The server handles connections using Go's concurrency primitives, with each client connection processed in its own goroutine. Commands are parsed using the RESP protocol implementation and executed against the in-memory data store.
- Go 1.24+
# Clone the repository
git clone https://github.com/GedisCaching/Gedis.git
cd Gedis
# Build and run
make run
- Start the server
- telnet 127.0.0.1 7000
VID_20250425050040.1.mp4
package main
import (
gedis "github.com/GedisCaching/Gedis/gedis"
)
func main() {
GedisClient, err := gedis.NewGedis(gedis.Config{
Address: Address,
Password: Password,
})
}
Gedis supports a subset of Redis commands, organized by data type:
GET key
- Get the value of a keySET key value
- Set the value of a keyGETDEL key
- Get the value and delete the keyDEL key
- Delete a key
KEYS
- Get all keys in the databaseTTL key
- Get the time to live of a keyEXPIRE key seconds
- Set the expiration time of a keyRENAME oldkey newkey
- Rename a key
LPUSH key value [value ...]
- Add values to the head of a listRPUSH key value [value ...]
- Add values to the tail of a listLPOP key
- Remove and get the first element of a listRPOP key
- Remove and get the last element of a listLLEN key
- Get the length of a listLRANGE key start stop
- Get elements from a listLSET key index value
- Set the value of an element in a list by its index
HSET key field value
- Set the value of a hash fieldHGET key field
- Get the value of a hash fieldHDEL key field [field ...]
- Delete fields from a hashHGETALL key
- Get all fields and values from a hashHKEYS key
- Get all field names in a hashHVALS key
- Get all values in a hashHLEN key
- Get the number of fields in a hash
ZADD key score member
- Add members to a sorted setZRANGE key start stop [WITHSCORES]
- Get elements from a sorted setZRANK key member
- Get the rank of a member in a sorted set
INCR key
- Increment the value of a keyDECR key
- Decrement the value of a key
Contributions are welcome! To contribute:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add some amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is open source and available under the MIT License.
Gedis-Client is a Go-based client for interacting with the Gedis caching server, a Redis-like in-memory data store. This client provides a simple and intuitive way to interact with Gedis server, allowing you to perform various operations like basic key-value operations, list operations, hash operations, sorted sets, and more.