Mercurial > hg > orthanc
diff Core/Cache/MemoryCache.h @ 3557:4d809b2e1141
better cache toolbox: MemoryObjectCache
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Nov 2019 15:18:38 +0100 |
parents | 4e43e67f8ecf |
children | 94f4a18a79cc |
line wrap: on
line diff
--- a/Core/Cache/MemoryCache.h Thu Oct 31 14:00:39 2019 +0100 +++ b/Core/Cache/MemoryCache.h Mon Nov 04 15:18:38 2019 +0100 @@ -39,32 +39,35 @@ namespace Orthanc { - /** - * WARNING: This class is NOT thread-safe. - **/ - class MemoryCache + namespace Deprecated { - private: - struct Page + /** + * WARNING: This class is NOT thread-safe. + **/ + class MemoryCache { - std::string id_; - std::auto_ptr<IDynamicObject> content_; - }; + private: + struct Page + { + std::string id_; + std::auto_ptr<IDynamicObject> content_; + }; - ICachePageProvider& provider_; - size_t cacheSize_; - LeastRecentlyUsedIndex<std::string, Page*> index_; + ICachePageProvider& provider_; + size_t cacheSize_; + LeastRecentlyUsedIndex<std::string, Page*> index_; - Page& Load(const std::string& id); + Page& Load(const std::string& id); - public: - MemoryCache(ICachePageProvider& provider, - size_t cacheSize); + public: + MemoryCache(ICachePageProvider& provider, + size_t cacheSize); - ~MemoryCache(); + ~MemoryCache(); - IDynamicObject& Access(const std::string& id); + IDynamicObject& Access(const std::string& id); - void Invalidate(const std::string& id); - }; + void Invalidate(const std::string& id); + }; + } }