comparison OrthancFramework/Sources/Cache/SharedArchive.cpp @ 5310:b5c502bcaf99

added a route to DELETE /jobs/../archive
author Alain Mazy <am@osimis.io>
date Mon, 12 Jun 2023 18:42:06 +0200
parents 0ea402b4d901
children 48b8dae6dc77
comparison
equal deleted inserted replaced
5309:fb231da5c0f1 5310:b5c502bcaf99
100 } 100 }
101 101
102 102
103 std::string SharedArchive::Add(IDynamicObject* obj) 103 std::string SharedArchive::Add(IDynamicObject* obj)
104 { 104 {
105 boost::mutex::scoped_lock lock(mutex_); 105 boost::recursive_mutex::scoped_lock lock(mutex_);
106 106
107 if (archive_.size() == maxSize_) 107 if (archive_.size() == maxSize_)
108 { 108 {
109 // The quota has been reached, remove the oldest element 109 // The quota has been reached, remove the oldest element
110 RemoveInternal(lru_.GetOldest()); 110 RemoveInternal(lru_.GetOldest());
120 } 120 }
121 121
122 122
123 void SharedArchive::Remove(const std::string& id) 123 void SharedArchive::Remove(const std::string& id)
124 { 124 {
125 boost::mutex::scoped_lock lock(mutex_); 125 boost::recursive_mutex::scoped_lock lock(mutex_);
126 RemoveInternal(id); 126 RemoveInternal(id);
127 } 127 }
128 128
129 129
130 void SharedArchive::List(std::list<std::string>& items) 130 void SharedArchive::List(std::list<std::string>& items)
131 { 131 {
132 items.clear(); 132 items.clear();
133 133
134 { 134 {
135 boost::mutex::scoped_lock lock(mutex_); 135 boost::recursive_mutex::scoped_lock lock(mutex_);
136 136
137 for (Archive::const_iterator it = archive_.begin(); 137 for (Archive::const_iterator it = archive_.begin();
138 it != archive_.end(); ++it) 138 it != archive_.end(); ++it)
139 { 139 {
140 items.push_back(it->first); 140 items.push_back(it->first);