Skip to content

Commit 5448de2

Browse files
committed
Update README.md to reflect new Redis session engine and configuration changes
1 parent fac5c18 commit 5448de2

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ For production applications, consider these external engines:
524524

525525
| Engine | Use Case | shard.yml |
526526
|--------|----------|-------|
527-
| **[Redis](https://github.com/neovintage/kemal-session-redis)** | High performance, multiple servers | `neovintage/kemal-session-redis` |
527+
| **[Redis](https://github.com/crystal-garage/kemal-session-redis-engine)** | High performance, multiple servers | `crystal-garage/kemal-session-redis-engine` |
528528
| **[PostgreSQL](https://github.com/mang/kemal-session-postgres)** | Existing PostgreSQL infrastructure | `mang/kemal-session-postgres` |
529529
| **[MySQL](https://github.com/crisward/kemal-session-mysql)** | Existing MySQL infrastructure | `crisward/kemal-session-mysql` |
530530
| **[RethinkDB](https://github.com/kingsleyh/kemal-session-rethinkdb)** | Real-time applications | `kingsleyh/kemal-session-rethinkdb` |
@@ -536,21 +536,34 @@ For production applications, consider these external engines:
536536
dependencies:
537537
kemal-session:
538538
github: kemalcr/kemal-session
539-
kemal-session-redis:
540-
github: neovintage/kemal-session-redis
539+
kemal-session-redis-engine:
540+
github: crystal-garage/kemal-session-redis-engin
541541
```
542542
543543
```crystal
544544
require "kemal"
545545
require "kemal-session"
546-
require "kemal-session-redis"
546+
require "kemal-session-redis-engine"
547547

548-
Kemal::Session.config.engine = Kemal::Session::RedisEngine.new(
549-
host: "localhost",
550-
port: 6379,
551-
password: ENV["REDIS_PASSWORD"]?,
552-
database: 0
553-
)
548+
Kemal::Session.config do |config|
549+
config.cookie_name = "redis_test"
550+
config.secret = "a_secret"
551+
config.engine = Kemal::Session::RedisEngine.new(
552+
"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",
553+
key_prefix: "my_app:session:"
554+
)
555+
config.timeout = Time::Span.new(1, 0, 0)
556+
end
557+
558+
get "/" do
559+
puts "Hello World"
560+
end
561+
562+
post "/sign_in" do |context|
563+
context.session.int("see-it-works", 1)
564+
end
565+
566+
Kemal.run
554567
```
555568

556569
### Custom Engine

0 commit comments

Comments
 (0)