Mercurial > hg > orthanc
comparison OrthancFramework/Sources/Cache/MemoryStringCache.cpp @ 4792:434843934307 storage-cache
Added a StorageCache in the StorageAccessor
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 30 Sep 2021 12:14:19 +0200 |
parents | d9473bd5ed43 |
children | 7053502fbf97 |
comparison
equal
deleted
inserted
replaced
4790:9754d5f2f38a | 4792:434843934307 |
---|---|
33 public: | 33 public: |
34 explicit StringValue(const std::string& content) : | 34 explicit StringValue(const std::string& content) : |
35 content_(content) | 35 content_(content) |
36 { | 36 { |
37 } | 37 } |
38 | 38 |
39 explicit StringValue(const char* buffer, size_t size) : | |
40 content_(buffer, size) | |
41 { | |
42 } | |
43 | |
39 const std::string& GetContent() const | 44 const std::string& GetContent() const |
40 { | 45 { |
41 return content_; | 46 return content_; |
42 } | 47 } |
43 | 48 |
61 const std::string& value) | 66 const std::string& value) |
62 { | 67 { |
63 cache_.Acquire(key, new StringValue(value)); | 68 cache_.Acquire(key, new StringValue(value)); |
64 } | 69 } |
65 | 70 |
71 void MemoryStringCache::Add(const std::string& key, | |
72 const void* buffer, | |
73 size_t size) | |
74 { | |
75 cache_.Acquire(key, new StringValue(reinterpret_cast<const char*>(buffer), size)); | |
76 } | |
77 | |
66 void MemoryStringCache::Invalidate(const std::string &key) | 78 void MemoryStringCache::Invalidate(const std::string &key) |
67 { | 79 { |
68 cache_.Invalidate(key); | 80 cache_.Invalidate(key); |
69 } | 81 } |
70 | 82 |