Mercurial > hg > orthanc
comparison Core/Cache/MemoryObjectCache.h @ 3563:4812825e69fc
accessor to the cache can now require to be unique
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 Nov 2019 15:35:18 +0100 |
parents | fb759c9efd73 |
children | 94f4a18a79cc |
comparison
equal
deleted
inserted
replaced
3562:f47149cdc048 | 3563:4812825e69fc |
---|---|
81 void Acquire(const std::string& key, | 81 void Acquire(const std::string& key, |
82 ICacheable* value); | 82 ICacheable* value); |
83 | 83 |
84 void Invalidate(const std::string& key); | 84 void Invalidate(const std::string& key); |
85 | 85 |
86 class Reader : public boost::noncopyable | 86 class Accessor : public boost::noncopyable |
87 { | 87 { |
88 private: | 88 private: |
89 #if !defined(__EMSCRIPTEN__) | 89 #if !defined(__EMSCRIPTEN__) |
90 ReaderLock contentLock_; | 90 ReaderLock readerLock_; |
91 WriterLock writerLock_; | |
91 boost::mutex::scoped_lock cacheLock_; | 92 boost::mutex::scoped_lock cacheLock_; |
92 #endif | 93 #endif |
93 | 94 |
94 Item* item_; | 95 Item* item_; |
95 | 96 |
96 public: | 97 public: |
97 Reader(MemoryObjectCache& cache, | 98 Accessor(MemoryObjectCache& cache, |
98 const std::string& key); | 99 const std::string& key, |
100 bool unique); | |
99 | 101 |
100 bool IsValid() const | 102 bool IsValid() const |
101 { | 103 { |
102 return item_ != NULL; | 104 return item_ != NULL; |
103 } | 105 } |