Mercurial > hg > orthanc
comparison OrthancFramework/Sources/FileStorage/StorageCache.h @ 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 | |
children | 7053502fbf97 |
comparison
equal
deleted
inserted
replaced
4790:9754d5f2f38a | 4792:434843934307 |
---|---|
1 /** | |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with this program. If not, see | |
19 * <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../Cache/MemoryStringCache.h" | |
26 | |
27 #include "../Compatibility.h" // For ORTHANC_OVERRIDE | |
28 | |
29 #include <boost/thread/mutex.hpp> | |
30 #include <map> | |
31 | |
32 namespace Orthanc | |
33 { | |
34 /** | |
35 * Note: this class is thread safe | |
36 **/ | |
37 class ORTHANC_PUBLIC StorageCache : public boost::noncopyable | |
38 { | |
39 MemoryStringCache cache_; | |
40 public: | |
41 void SetMaximumSize(size_t size); | |
42 | |
43 void Add(const std::string& uuid, | |
44 FileContentType contentType, | |
45 const std::string& value); | |
46 | |
47 void Add(const std::string& uuid, | |
48 FileContentType contentType, | |
49 const void* buffer, | |
50 size_t size); | |
51 | |
52 void Invalidate(const std::string& uuid, FileContentType contentType); | |
53 | |
54 bool Fetch(std::string& value, | |
55 const std::string& uuid, | |
56 FileContentType contentType); | |
57 | |
58 }; | |
59 } |