This is a simple Redis cache implementation in Go using the go-redis/redis package.
To use this package in your Go project, run the following command: go get github.com/your-username/redis-cache
To use the Redis cache, first create a new cache instance by calling the NewCache function:
cache := redis.NewCache("localhost", "6379", "PASSWORD")
This will create a new Redis client and return a new Cache instance.Creates a new cache instance with the provided Redis server address, port, and password.
Retrieves the value associated with the given key from the cache.
Sets a key-value pair in the cache with the specified expiration time.
Deletes the key from the cache.
Checks if the key exists in the cache.
Retrieves the value associated with the given key from the cache. If the key does not exist, it sets the key-value pair with the provided default value.
Sets the expiration time for the given key in the cache.
Increments the value of the given key in the cache.
Decrements the value of the given key in the cache.
Gets the remaining time to live for the given key in the cache.
Gets all keys matching the provided pattern from the cache.
Flushes all keys from the cache.
Closes the cache connection.