~ K A L I ~
UNAME : Linux web62.extendcp.co.uk 4.18.0-553.58.1.el8_10.x86_64 #1 SMP Wed Jun 25 06:37:46 EDT 2025 x86_64SERVER IP : 10.0.187.62 -________-
CLIENT IP : 216.73.216.199 MINI SHELL D ZAB '
Current File : //usr/share/gems/gems/multi_json-1.13.1/lib/multi_json/options_cache.rb |
module MultiJson
module OptionsCache
extend self
def reset
@dump_cache = {}
@load_cache = {}
end
def fetch(type, key)
cache = instance_variable_get("@#{type}_cache")
cache.key?(key) ? cache[key] : write(cache, key, &Proc.new)
end
private
# Normally MultiJson is used with a few option sets for both dump/load
# methods. When options are generated dynamically though, every call would
# cause a cache miss and the cache would grow indefinitely. To prevent
# this, we just reset the cache every time the number of keys outgrows
# 1000.
MAX_CACHE_SIZE = 1000
def write(cache, key)
cache.clear if cache.length >= MAX_CACHE_SIZE
cache[key] = yield
end
end
end
Coded by KALI :v Greetz to DR HARD ../ kali.zbi@hotmail.com