/*
- * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#define SQUID_STORE_STORAGE_H
#include "base/RefCount.h"
+#include "http/RequestMethod.h"
#include "store/forward.h"
+#include "store_key_md5.h"
class StoreInfoStats;
class Storage: public RefCountable
{
public:
- virtual ~Storage() {}
+ ~Storage() override {}
/// create system resources needed for this store to operate in the future
virtual void create() = 0;
/// use readable() and writable() methods.
virtual void init() = 0;
- /// Retrieve a store entry from the store (blocking)
- virtual StoreEntry *get(const cache_key *) = 0;
-
/**
* The maximum size the store will support in normal use. Inaccuracy is
* permitted, but may throw estimates for memory etc out of whack.
/**
* Output stats to the provided store entry.
- \todo make these calls asynchronous
+ * TODO: make these calls asynchronous
*/
virtual void stat(StoreEntry &e) const = 0;
- /// expect an unlink() call after the entry becomes idle
- virtual void markForUnlink(StoreEntry &e) = 0;
+ /// Prevent new get() calls from returning the matching entry.
+ /// If the matching entry is unused, it may be removed from the store now.
+ /// The store entry is matched using either `e` attachment info or `e.key`.
+ virtual void evictCached(StoreEntry &e) = 0;
- /// remove the entry from the store
- virtual void unlink(StoreEntry &e) = 0;
+ /// An evictCached() equivalent for callers that did not get() a StoreEntry.
+ /// Callers with StoreEntry objects must use evictCached() instead.
+ virtual void evictIfFound(const cache_key *) = 0;
/// called once every main loop iteration; TODO: Move to UFS code.
virtual int callback() { return 0; }
/// prepare for shutdown
virtual void sync() {}
-
- /// whether this storage is capable of serving multiple workers;
- /// a true result does not imply [lack of] non-SMP support because
- /// [only] some SMP-aware storages also support non-SMP configss
- virtual bool smpAware() const = 0;
};
} // namespace Store