Redis store for kemal-session
0.1.0 Yanked release released


Redis session store for kemal-session.


Add this to your application's shard.yml:

    github: neovintage/kemal-session-redis
    version: 0.1.0


require "kemal"
require "kemal-session"
require "kemal-session-redis"

Session.config do |config|
  config.cookie_name = "redis_test"
  config.secret = "a_secret"
  config.engine = "localhost", port: 1234)
  config.timeout =, 0, 0)

get "/" do
  puts "Hello World"

post "/sign_in" do |context|"see-it-works", 1)

The engine comes with a number of configuration options:

| Option | Description | | ------ | ----------- | | host | where your redis instance lives | | port | assigned port for redis instance | | unixsocket | Use a socket instead of host/port. This will override host / port settings | | database | which database to use when after connecting to redis. defaults to 0 | | capacity | how many connections the connection pool should create. defaults to 20 | | timeout | how long until a connection is considered long-running. defaults to 2.0 (seconds) | | pool | an instance of ConnectionPool(Redis). This overrides any setting in host or unixsocket | | key_prefix | when saving sessions to redis, how should the keys be namespaced. defaults to kemal:session: |

When the Redis engine is instantiated and a connection pool isn't passed, RedisEngine will create a connection pool for you. The pool will have 20 connections and a timeout of 2 seconds. It's recommended that a connection pool be created to serve the wider application and then that passed to the RedisEngine initializer.

If no options are passed the RedisEngine will try to connect to a Redis using default settings.

Best Practice

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.


Redis must be running on localhost and bound to the default port to run specs.


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


  • [neovintage] Rimas Silkaitis - creator, maintainer
  github: mamantoha/kemal-session-redis
  version: ~> 0.1.0
License MIT
Crystal none


Dependencies 3

  • kemal-session master
    {'branch' => 'master', 'github' => 'kemalcr/kemal-session'}
  • pool 0.2.3
    {'github' => 'ysbaddaden/pool', 'version' => '0.2.3'}
  • redis ~> 1.6.7
    {'github' => 'stefanwille/crystal-redis', 'version' => '~> 1.6.7'}

Development Dependencies 0

Dependents 0

Last synced .
search fire star recently