Session
Constants
CONFIG = Configuration.new
Log = ::Log.for("session")
Class methods
config
Sourceconfigure
Applies the block to CONFIG, then checks it: a store that encrypts with the secret fails here,
at boot, when the secret is unusable (SessionHandler checks again on each request).
session
SourceMacros
use_store(store_type)
Injects a typed store property into Session::Configuration for the given store type.
Crystal's invariant generics mean CookieStore(UserSession) cannot be assigned to
Store(Base)?. Calling use_store reopens Configuration in the library's own
namespace so that the property carries the exact concrete type, keeping your
application code free of class-reopen boilerplate.
Call this before Session.configure:
Session.use_store(Session::CookieStore(UserSession))
Session.configure do |c|
# The secret is read from SESSION_SECRET (random per process in development without it)
c.store = Session::CookieStore(UserSession).new
end
Nested types
- Session::AuthenticationHandler(T)
- Session::Base
- Session::CircuitBreaker
- Session::CircuitBreakerConfig
- Session::CircuitOpenException
- Session::CircuitState
- Session::ClientFingerprint
- Session::ClusterConfig
- Session::ClusterConnectionException
- Session::ClusterCoordinator(T)
- Session::ClusterException
- Session::ClusterMessage
- Session::ClusterMessageType
- Session::ClusterSubscriptionException
- Session::ClusteredRedisStore(T)
- Session::CommitOnWrite
- Session::Compression
- Session::Configuration
- Session::ConnectionPool
- Session::ConnectionPoolConfig
- Session::ConnectionPoolTimeoutException
- Session::CookieSizeExceededException
- Session::CookieStore(T)
- Session::Flash
- Session::InsecureSecretException
- Session::InvalidCookieOptions
- Session::LocalCache(T)
- Session::MemoryStore(T)
- Session::Metrics
- Session::PooledRedisStore(T)
- Session::Presets
- Session::QueryableStore(T)
- Session::RedisStore(T)
- Session::RedisUtils
- Session::Retry
- Session::RetryConfig
- Session::SessionBindingException
- Session::SessionCorruptionException
- Session::SessionEncryptionException
- Session::SessionExpiredException
- Session::SessionHandler(T)
- Session::SessionNotFoundException
- Session::SessionSerializationException
- Session::SessionValidationException
- Session::StorageConnectionException
- Session::Store(T)
- Session::Web