if (entryLimit <= 0)
return; // no memory cache configured or a misconfiguration
+ if (IamWorkerProcess()) { // XXX: coordinator should not create MemStore
+ const int64_t max_size = Store::Root().maxObjectSize();
+ if (max_size == -1) {
+ debugs(20, DBG_IMPORTANT, "WARNING: disk-cache maximum object size "
+ "is unlimited but mem-cache maximum object size is " <<
+ Ipc::Mem::PageSize());
+ } else if (max_size > maxObjectSize()) {
+ debugs(20, DBG_IMPORTANT, "WARNING: disk-cache maximum object size "
+ "is too large for mem-cache: " <<
+ Store::Root().maxObjectSize() << " > " << maxObjectSize());
+ }
+ }
+
map = new MemStoreMap(ShmLabel);
map->cleaner = this;
}
return map ? map->entryCount() : 0;
}
+int64_t
+MemStore::maxObjectSize() const
+{
+ return Ipc::Mem::PageSize();
+}
+
void
MemStore::updateSize(int64_t eSize, int sign)
{
if (!Config.memMaxSize)
return 0; // no memory cache configured
- // TODO: warn if we cannot support the configured maximum entry size
const int64_t entrySize = Ipc::Mem::PageSize(); // for now
const int64_t entryLimit = Config.memMaxSize / entrySize;
// TODO: warn if we cannot cache at least one item (misconfiguration)
virtual uint64_t minSize() const;
virtual uint64_t currentSize() const;
virtual uint64_t currentCount() const;
+ virtual int64_t maxObjectSize() const;
virtual void stat(StoreEntry &) const;
virtual StoreSearch *search(String const url, HttpRequest *);
virtual void reference(StoreEntry &);
/** the total number of objects stored */
virtual uint64_t currentCount() const = 0;
+ /** the maximum object size that can be stored, -1 if unlimited */
+ virtual int64_t maxObjectSize() const = 0;
+
/**
* Output stats to the provided store entry.
\todo make these calls asynchronous
virtual uint64_t currentCount() const;
+ virtual int64_t maxObjectSize() const;
+
virtual void stat(StoreEntry&) const;
virtual void reference(StoreEntry&);
virtual uint64_t currentCount() const;
+ virtual int64_t maxObjectSize() const;
+
virtual void stat(StoreEntry &) const;
virtual void sync(); /* Sync the store prior to shutdown */
virtual uint64_t currentCount() const { return n_disk_objects; }
+ virtual int64_t maxObjectSize() const { return max_objsize; }
+
virtual void stat (StoreEntry &anEntry) const;
virtual StoreSearch *search(String const url, HttpRequest *) = 0;
return swapDir->currentCount();
}
+int64_t
+StoreController::maxObjectSize() const
+{
+ return swapDir->maxObjectSize();
+}
+
void
SwapDir::diskFull()
{
return result;
}
+int64_t
+StoreHashIndex::maxObjectSize() const
+{
+ int64_t result = -1;
+
+ for (int i = 0; i < Config.cacheSwap.n_configured; i++) {
+ if (dir(i).active() && store(i)->maxObjectSize() > result)
+ result = store(i)->maxObjectSize();
+ }
+
+ return result;
+}
+
void
StoreHashIndex::stat(StoreEntry & output) const
{