redis_cache_store
Version, currently 0.5.015 versions
- 1.1.0latestJun 19, 2026
- 1.0.0not indexedJul 26, 2026
- 0.5.2not indexedJul 26, 2026
- 0.5.1not indexedJul 26, 2026
- 0.5.0not indexedJul 26, 2026
- 0.4.1not indexedJul 26, 2026
- 0.4.0not indexedJul 26, 2026
- 0.3.1not indexedJul 26, 2026
- 0.3.0not indexedJul 26, 2026
- 0.2.3not indexedJul 26, 2026
- 0.2.2not indexedJul 26, 2026
- 0.2.1not indexedJul 26, 2026
- 0.2.0not indexedJul 26, 2026
- 0.1.1not indexedJul 26, 2026
- 0.1.0not indexedJul 26, 2026
github.com/crystal-cache/redis_cache_store
A cache store implementation that stores data in Redis
Nothing has been indexed for 0.5.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
redis_cache_store:
github: crystal-cache/redis_cache_store
version: ~> 0.5.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.5.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Cache::RedisCacheStore
A cache store implementation that stores data in Redis.
This shard uses jgaskins/redis as the Redis client library.
If you're looking for an implementation that uses stefanwille/crystal-redis check https://github.com/crystal-cache/redis_legacy_cache_store.
Installation
-
Add the dependency to your
shard.yml:dependencies: redis_cache_store: github: crystal-cache/redis_cache_store -
Run
shards install
Usage
require "redis_cache_store"
Redis cache values are stored as strings. Values passed to write are converted with to_s, and reads return Redis strings.
Use a positive expires_in value. Redis-backed entries with zero or negative expiration are not kept.
cache = Cache::RedisCacheStore(String).new(expires_in: 1.minute, namespace: "myapp-cache")
# Fetches data from the Redis, using "myapp-cache:today" key. If there is data in
# the Redis with the given key, then that data is returned.
#
# If there is no such data in the Redis (a cache miss or expired), then
# block will be written to the Redis under the given cache key, and that
# return value will be returned.
day_of_week = cache.fetch("today") { Time.utc.day_of_week.to_s }
puts day_of_week # => Wednesday
# Store a value in the cache
cache.write("greeting", "Hello, world!")
# Retrieve the value from the cache
greeting = cache.read("greeting")
puts greeting # Output: Hello, world!
# Delete a value from the cache
cache.delete("greeting")
No namespace is set by default. Provide one if the Redis cache
server is shared with other apps:
This assumes Redis was started with a default configuration, and is listening on localhost, port 6379.
You can connect to Redis by instantiating the Redis::Client class.
If you need to connect to a remote server or a different port, try:
redis_uri = URI.parse("rediss://:my-secret-pw@10.0.1.1:6380/1")
redis = Redis::Client.new(uri: redis_uri)
cache = Cache::RedisCacheStore(String).new(expires_in: 1.minute, cache: redis)
Contributing
- Fork it (https://github.com/crystal-cache/redis_cache_store/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Anton Maminov - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.5.0- Tagged
- Jul 26, 2026
- Commit
b4e2a9dfbfc3- Indexed
- not yet
Dependents
Repository
github.com/crystal-cache/redis_cache_store
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 24, 2026
- Synced
- Sep 24, 2026
- Versions
- 15