mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-13 03:12:13 +00:00
When the cache is constructed with expiry == 0 the underlying storage is never instantiated and get_ptr() asserts via caching_enabled(). This is fine for callers that need a handle into the cache, but it makes get_ptr() unusable for write-only insertions on caches whose expiry is configurable at runtime (e.g. caches driven by a LiveUpdate config option that the operator may set to 0). Add a new insert(k, load) method on loading_cache that returns a future<> and is a no-op when caching is disabled, otherwise forwards to get_ptr(k, load) and discards the resulting handle. This completes the disabled-mode safety contract of the cache for the write side, mirroring the fallback that get() already provides for the read side. Switch authorized_prepared_statements_cache::insert() from get_ptr().discard_result() to the new insert(), which fixes the crash 'Assertion caching_enabled() failed' in authorized_prepared_statements_cache::insert() that occurs when permissions_validity_in_ms is set to 0 and a prepared statement is executed under authentication. Fixes SCYLLADB-1699
36 KiB
36 KiB