I'ved created a standalone session system based on Redis database.
This session system was not build only for web in mind, but also for non web based systems.
I for example, use it with Asterisk based programs that I'm writing to clients.
The session lib supports at the moment only few features:
- Connect to Unix sockets
- Connect to TCP sockets, and changing the port number if needed
- Expiring all keys
- Expiring specific keys
- Changing expiry of a specific key
- Checking expiry of a specific key
- Saving and restoring Ruby based structures such as hashes, arrays, boolean etc…
- Removing keys
- Prefix that will be automatically added to each key name (in saving and restoring)
The usage of the system is very simple:
require 'rubygems' | |
require 'redis_session' | |
session = Session::SessionClient.new(:prefix => 'add_test') # init the session | |
session.save('name', { 'name' => 'session'}) # Saving a content. Pure ruby content | |
restored = session.restore('name') # return to me a pure ruby content | |
puts restored.inspect | |
session.remove('name') # delete the key |
The current version (0.1.3), does not contain yet any documentation. However it will be added in next version.
The library itself is under the MIT license, and can be downloaded here.
You can create your own gem file. I hope that by the next version, it will be created automatically.
* You must have active Javascript support for wordpress.com and github to view the source code.