lib/rack_datamapper/session/abstract/store.rb in rack-datamapper-0.2.4 vs lib/rack_datamapper/session/abstract/store.rb in rack-datamapper-0.2.5
- old
+ new
@@ -5,11 +5,11 @@
module Abstract
class Store
def initialize(app, options, id_generator)
@mutex = Mutex.new
- if options.delete(:cache)
+ if cache = options.delete(:cache)
@@cache = if RUBY_PLATFORM =~ /java/
begin
# to avoid memory leaks use a hashmap which clears
# itself on severe memory shortage
require 'softhashmap'
@@ -25,10 +25,10 @@
else
{}
end
@@semaphore = Mutex.new
else
- @@cache = nil unless self.class.class_variable_defined? :@@cache
+ @@cache = nil unless cache.nil? && self.class.class_variable_defined?(:@@cache)
end
@@session_class = options.delete(:session_class) || Session unless (self.class.class_variable_defined?(:@@session_class) and @@session_class)
@id_generator = id_generator
end