Skip to content

AlyssaDaemon/sinatra-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinatra-redis

Dead simple redis module for Sinatra

require "sinatra-redis"
require "sinatra/base"

class SinatraRedisExample < Sinatra::Base
  register Sinatra::Redis

  set :redis_url, "redis://localhost:6379" # You don't have to set either, but for completion sake
  set :redis_pool_size, 5

  get "/" do
    @val = redis.get "LastVisit"
    redis.set "LastVisit", Time.now.to_i
    "Last Visit was at #{Time.at(Integer(@val)) rescue 'Never'}"
  end

end

SinatraRedisExample.run!

About

Redis for Sinatra

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages