Class Nav::Cache
In: nav.rb
Parent: Object

Nav::Cache

Because mod_ruby keeps classes in memory between page accesses, we should be able to open a connection to the cache database once, assign it to a class variable, and then use it repeatedly without having to re-open it. And indeed, this approach worked well with earlier versions of 'bdb', the Ruby interface to Berkeley DB.

For reasons unknown to me, however, newer versions of ruby-bdb seem to automatically close any open database connections when a cgi script exits, even if the connection is held open by a persistent class variable. This Cache class provides a workaround by checking the connection's state before each access, re-opening it if necessary.

Methods
access    open   
Included modules
Singleton
Public Instance methods
open()
access(key, val=nil)