Skip to content

Commit 6b0f5d2

Browse files
authored
Update README.md to reflect new Redis session engine and configuration changes (#114)
1 parent b31c930 commit 6b0f5d2

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
@@ -528,7 +528,7 @@ For production applications, consider these external engines:
528528

529529
| Engine | Use Case | shard.yml |
530530
|--------|----------|-------|
531-
| **[Redis](https://github.com/neovintage/kemal-session-redis)** | High performance, multiple servers | `neovintage/kemal-session-redis` |
531+
| **[Redis](https://github.com/crystal-garage/kemal-session-redis-engine)** | High performance, multiple servers | `crystal-garage/kemal-session-redis-engine` |
532532
| **[PostgreSQL](https://github.com/mang/kemal-session-postgres)** | Existing PostgreSQL infrastructure | `mang/kemal-session-postgres` |
533533
| **[MySQL](https://github.com/crisward/kemal-session-mysql)** | Existing MySQL infrastructure | `crisward/kemal-session-mysql` |
534534
| **[RethinkDB](https://github.com/kingsleyh/kemal-session-rethinkdb)** | Real-time applications | `kingsleyh/kemal-session-rethinkdb` |
@@ -540,21 +540,34 @@ For production applications, consider these external engines:
540540
dependencies:
541541
kemal-session:
542542
github: kemalcr/kemal-session
543-
kemal-session-redis:
544-
github: neovintage/kemal-session-redis
543+
kemal-session-redis-engine:
544+
github: crystal-garage/kemal-session-redis-engin
545545
```
546546
547547
```crystal
548548
require "kemal"
549549
require "kemal-session"
550-
require "kemal-session-redis"
550+
require "kemal-session-redis-engine"
551551

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

560573
### Custom Engine

0 commit comments

Comments
 (0)