No commit activity in last 3 years
No release in over 3 years
A rack-based session store on plain file system.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9

Runtime

>= 1.1.0
 Project Readme

Rack::Session::File

Rack session store on plain file system.

Usage

In Rack Applications

On Gemfile:

gem 'rack-session-file'

And use Rack::Session::File as Rack Middleware:

use Rack::Session::File, :storage => ENV['TEMP'],
                         :expire_after => 1800

NOTICE: Never use this module in conjunction with other session middlewares (especially Rack::Session::Cookie). That would brake session handling.

For Sinatra and Padrino

Do not enable session mechanism by enable :session. Built-in session of Sinatra (and Padrino) utilizes Rack::Session::Cookie, so it will interfere this module's behavior. Using this middleware makes session[] available in your application without enable :session.

In Rails 3 Applications

On Gemfile:

gem 'rack-session-file', :require => 'rails-session-file'

And modify your config/initializers/session_store.rb to something like:

FooBar::Application.config.session_store :file_store,
  :key => '_foobar_session', :driver => 'YAML'

Options

File storage directory (:storage)

Default is Dir.tmpdir.

Backend serializer (:driver)

You can specify backend serializer via :driver option.

use Rack::Session::File, :driver => :YAML

Bundled drivers are:

  • :PStore (default)
  • :YAML
  • :Marshal (discouraged to use)

Also you can use backend driver class explicitly.

use Rack::Session::File::YAML

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Acknowledgement

Most of main code and test codes are derived from titanous's mongo-store and udzura's rack-session-dbm.

Copyright and license

Copyright © 2012 ITO Nobuaki.
Copyright © 2011 Uchio Kondo. (as the author of rack-session-dbm )
Copyright © 2010 Jonathan Rudenberg. (as the author of mongo-store )
See LICENSE for details (MIT License).