Query Interface
Supported Stores
Store
QueryableStore
Methods
Method
Return
Description
Examples
store = Session::MemoryStore(UserSession).new
# Find all admin sessions
admins = store.find_by { |s| s.role == "admin" }
# Count authenticated sessions
count = store.count_by { |s| s.authenticated? }
# Revoke all sessions for a compromised user
deleted = store.bulk_delete { |s| s.user_id == compromised_id }
# Find first matching session
session = store.find_first { |s| s.username == "alice" }
# Get all session IDs
ids = store.all_session_ids
# Iterate all sessions
store.each_session { |s| puts "#{s.session_id}: #{s.username}" }Performance Notes
See Also
Last updated
Was this helpful?