Mercurial > hg > orthanc-stone
diff Framework/Deprecated/Toolbox/BaseWebService.h @ 872:733c6db3e5a3 am-dev
limiting the size of the cache
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 01 Jul 2019 13:36:51 +0200 |
parents | c35e98d22764 |
children | 200b4e0dddfc |
line wrap: on
line diff
--- a/Framework/Deprecated/Toolbox/BaseWebService.h Mon Jun 24 16:29:49 2019 +0200 +++ b/Framework/Deprecated/Toolbox/BaseWebService.h Mon Jul 01 13:36:51 2019 +0200 @@ -25,6 +25,7 @@ #include <string> #include <map> +#include <deque> namespace Deprecated { @@ -81,14 +82,21 @@ class BaseWebServicePayload; bool cacheEnabled_; - std::map<std::string, boost::shared_ptr<CachedHttpRequestSuccessMessage> > cache_; // TODO: this is currently an infinite cache ! + size_t cacheCurrentSize_; + size_t cacheMaxSize_; + + typedef std::map<std::string, boost::shared_ptr<CachedHttpRequestSuccessMessage> > HttpCache; + HttpCache cache_; + std::deque<std::string> orderedCacheKeys_; public: BaseWebService(OrthancStone::MessageBroker& broker) : IWebService(broker), IObserver(broker), - cacheEnabled_(true) + cacheEnabled_(true), + cacheCurrentSize_(0), + cacheMaxSize_(100*1024*1024) { }