Class: OpenWeatherClient::Caching::Memory
- Inherits:
-
OpenWeatherClient::Caching
- Object
- OpenWeatherClient::Caching
- OpenWeatherClient::Caching::Memory
- Defined in:
- lib/open_weather_client/caching/memory.rb
Overview
Memory cache of OpenWeatherMap requests
The requests are cached in memory up to the number specified in config.max_memory_entries. When the limit is reached the least recently used entry is evicted.
Instance Attribute Summary collapse
-
#memory_cache ⇒ Object
readonly
Memory cache to store a hash of keys and request data.
-
#memory_keys ⇒ Object
readonly
Key registry of the memory cache.
Instance Method Summary collapse
-
#initialize ⇒ Memory
constructor
Initialize an empty cache.
Methods inherited from OpenWeatherClient::Caching
Constructor Details
#initialize ⇒ Memory
Initialize an empty cache
18 19 20 21 22 |
# File 'lib/open_weather_client/caching/memory.rb', line 18 def initialize super @memory_cache = {} @memory_keys = [] end |
Instance Attribute Details
#memory_cache ⇒ Object (readonly)
Memory cache to store a hash of keys and request data
12 13 14 |
# File 'lib/open_weather_client/caching/memory.rb', line 12 def memory_cache @memory_cache end |
#memory_keys ⇒ Object (readonly)
Key registry of the memory cache. The first entry is the key of the least recently accessed data
14 15 16 |
# File 'lib/open_weather_client/caching/memory.rb', line 14 def memory_keys @memory_keys end |