chained_cache.push_back(cache);
}
+void ObjectCache::unchain_cache(RGWChainedCache *cache) {
+ RWLock::WLocker l(lock);
+
+ auto iter = chained_cache.begin();
+ for (; iter != chained_cache.end(); ++iter) {
+ if (cache == *iter) {
+ chained_cache.erase(iter);
+ return;
+ }
+ }
+}
+
cache.chain_cache(cc);
}
+void RGWSI_SysObj_Cache::unregister_chained_cache(RGWChainedCache *cc)
+{
+ cache.unchain_cache(cc);
+}
+
static void cache_list_dump_helper(Formatter* f,
const std::string& name,
const ceph::real_time mtime,
bool chain_cache_entry(std::initializer_list<rgw_cache_entry_info *> cache_info_entries,
RGWChainedCache::Entry *chained_entry);
void register_chained_cache(RGWChainedCache *cc);
+ void unregister_chained_cache(RGWChainedCache *cc);
void call_list(const std::optional<std::string>& filter, Formatter* f);
int call_inspect(const std::string& target, Formatter* f);
public:
RGWChainedCacheImpl() : lock("RGWChainedCacheImpl::lock") {}
-
- void init(RGWSI_SysObj_Cache *svc) {
+ ~RGWChainedCacheImpl() {
if (!svc) {
return;
}
+ svc->unregister_chained_cache(this);
+ }
+
+ void init(RGWSI_SysObj_Cache *_svc) {
+ if (!_svc) {
+ return;
+ }
+ svc = _svc;
svc->register_chained_cache(this);
expiry = std::chrono::seconds(svc->ctx()->_conf.get_val<uint64_t>(
"rgw_cache_expiry_interval"));