Sha256: 037874e5d6d509154e158cc682bec3310c686de027b1bc0e068a1361fedf1b7a
Contents?: true
Size: 827 Bytes
Versions: 2
Compression:
Stored size: 827 Bytes
Contents
#!/usr/bin/env ruby require 'nitro/session' module Nitro class FileSessionStore # The session keepalive time. The session is eligable for # garbage collection after this time passes. setting :path, :default => "/tmp/nitro_session", :doc => 'The directory to store file session' def initialize @path = FileSessionStore.path Dir.mkdir(@path) unless File.exists?(@path) end def []=(k,v) File.open(File.join(@path, k), "w") { |f| f.write(Marshal.dump(v)) } end def [](k) fn = File.join(@path, k) return nil unless File.exists?(fn) Marshal.load( File.read(fn) ) end # def values # [] # end # # def each # #yield # end end Session.store = FileSessionStore.new end # * Guillaume Pierronnet <guillaume.pierronnet@gmail.com>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.24.0 | lib/nitro/session/file.rb |
nitro-0.25.0 | lib/nitro/session/file.rb |