kemal-session-redis-engine
Version, currently 1.2.37 versions
github.com/crystal-garage/kemal-session-redis-engine
Redis store for kemal-session
Nothing has been indexed for 1.2.3 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:
kemal-session-redis-engine:
github: crystal-garage/kemal-session-redis-engine
version: ~> 1.2.3Then run:
shards installshard.yml
No shard.yml has been indexed for 1.2.3. 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.
kemal-session-redis-engine
Redis session store for kemal-session implemented with jgaskins/redis client.
Installation
Add this to your application's shard.yml:
dependencies:
kemal-session-redis-engine:
github: crystal-garage/kemal-session-redis-engine
Usage
require "kemal"
require "kemal-session"
require "kemal-session-redis-engine"
Kemal::Session.config do |config|
config.cookie_name = "redis_test"
config.secret = "a_secret"
config.engine = Kemal::Session::RedisEngine.new(
"redis://localhost:6379/0?initial_pool_size=1&max_pool_size=10&checkout_timeout=10&retry_attempts=2&retry_delay=0.5&max_idle_pool_size=50",
key_prefix: "my_app:session:"
)
config.timeout = Time::Span.new(1, 0, 0)
end
get "/" do
puts "Hello World"
end
post "/sign_in" do |context|
context.session.int("see-it-works", 1)
end
Kemal.run
The engine comes with a number of configuration options:
| Option | Description |
|---|---|
| redis_url | where your redis instance lives. defaults to redis://localhost:6379/0 |
| key_prefix | when saving sessions to redis, how should the keys be namespaced. defaults to kemal:session: |
If no options are passed the RedisEngine will try to connect to a Redis using
default settings.
Best Practices
Creating a Client
It's very easy for client code to leak Redis connections and you should pass a pool of connections that's used throughout Kemal and the session engine.
Session Administration Performance
Kemal::Session.all and Kemal::Session.each perform a bit differently under the hood. If
Kemal::Session.all is used, the RedisEngine will use the SCAN command in Redis
and page through all of the sessions, hydrating the Session object and returing
an array of all sessions. If session storage has a large number of sessions this
could have performance implications. Kemal::Session.each also uses the SCAN command
in Redis but instead of creating one large array and enumerating through it,
Kemal::Session.each will only hydrate and yield the keys returned from the current
cursor. Once that block of sessions has been yielded, RedisEngine will retrieve
the next block of sessions.
Development
Redis must be running on localhost and bound to the default port to run specs.
Contributing
- Fork it ( https://github.com/crystal-garage/kemal-session-redis-engine/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
- [mamantoha] Anton Maminov - maintainer
- [neovintage] Rimas Silkaitis - creator, maintainer
- [crisward] Cris Ward
- [fdocr] Fernando Valverde
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.2.3- Tagged
- Jun 22, 2026
- Commit
765856e3c658- Indexed
- not yet
Dependents
Repository
github.com/crystal-garage/kemal-session-redis-engine
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 26, 2026
- Synced
- Sep 26, 2026
- Versions
- 7