Class: RackJwtAegis::SolidCacheAdapter
Overview
Solid Cache adapter (Rails 8+)
Instance Method Summary
collapse
build, #deserialize_value, #exist?, #serialize_value
Constructor Details
Returns a new instance of SolidCacheAdapter.
224
225
226
227
228
229
230
231
232
233
|
# File 'lib/rack_jwt_aegis/cache_adapter.rb', line 224
def initialize(options = {})
super
unless defined?(SolidCache)
raise CacheError, "SolidCache not available. Ensure you're using Rails 8+ with Solid Cache configured."
end
@cache = options[:cache_instance] || SolidCache
end
|
Instance Method Details
#clear ⇒ Object
257
258
259
260
261
262
|
# File 'lib/rack_jwt_aegis/cache_adapter.rb', line 257
def clear
@cache.clear
true
rescue StandardError => e
raise CacheError, "SolidCache clear error: #{e.message}"
end
|
#delete(key) ⇒ Object
250
251
252
253
254
255
|
# File 'lib/rack_jwt_aegis/cache_adapter.rb', line 250
def delete(key)
@cache.delete(key.to_s)
true
rescue StandardError => e
raise CacheError, "SolidCache delete error: #{e.message}"
end
|
#read(key) ⇒ Object
235
236
237
238
239
240
|
# File 'lib/rack_jwt_aegis/cache_adapter.rb', line 235
def read(key)
value = @cache.read(key.to_s)
deserialize_value(value)
rescue StandardError => e
raise CacheError, "SolidCache read error: #{e.message}"
end
|
#write(key, value, expires_in: nil) ⇒ Object
242
243
244
245
246
247
248
|
# File 'lib/rack_jwt_aegis/cache_adapter.rb', line 242
def write(key, value, expires_in: nil)
serialized_value = serialize_value(value)
@cache.write(key.to_s, serialized_value, expires_in: expires_in)
true
rescue StandardError => e
raise CacheError, "SolidCache write error: #{e.message}"
end
|