[Ruby-session-devel-cvs] CVS: ruby-session/src/session pstore.rb,NONE,1.1
Status: Alpha
Brought to you by:
thetitan
From: Sean C. <the...@us...> - 2002-06-20 13:45:38
|
Update of /cvsroot/ruby-session/ruby-session/src/session In directory usw-pr-cvs1:/tmp/cvs-serv14029 Added Files: pstore.rb Log Message: *) Added a pstore routine for quick and dirty sessioning --- NEW FILE: pstore.rb --- # See the LICENSE file for copyright and distribution information. # # $Id: pstore.rb,v 1.1 2002/06/20 13:45:34 thetitan Exp $ require 'pstore' class Session @@commit.push('pstore_commit') @@init.push('pstore_init') @@load.push('pstore_load') @@tmp = nil attr_accessor(:pstore_file) public def pstore_roots() @pstore_db = PStore.new(@pstore_file) if @pstore_db.nil? @pstore_db.transaction do |db| return(@pstore_db.roots) end # @pstore_db.transaction end # def pstore_roots() private def pstore_commit() @pstore_db = PStore.new(@pstore_file) if @pstore_db.nil? @pstore_db.transaction do @pstore_db[@session_id] = @@data end # @pstore_db.transaction end # def pstore_commit() def pstore_init() @pstore_db = nil @pstore_file = nil end # def pstore_init() def pstore_load() @pstore_db = PStore.new(@pstore_file) if @pstore_db.nil? begin @pstore_db.transaction do |db| @@data = db[@session_id] end # @pstore_db.transaction rescue PStore::Error # Couldn't find the session return(false) rescue TypeError # Empty pstore return(false) end # begin return(true) end # def pstore_load() end # module Session |