80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/toaster/db/cgi_session_cache.rb', line 80
def by_key(key_path_array)
load_cache()
if DO_CACHE_QUERIES
key_path_str = key_path_array.inspect
cached = @cache[KEY_QUERIES][key_path_str]
if cached
@hits << key_path_array
return cached
end
end
if DO_CACHE_OBJECTS
key_path_array = [key_path_array] if !key_path_array.kind_of?(Array)
obj = @cache
key_path_array.each do |k|
obj = obj[k]
if !obj
@misses << key_path_array
return nil
end
end
@hits << key_path_array
return obj
end
@misses << key_path_array
return nil
end
|