添加文件缓存
This commit is contained in:
1 parent
fb63205a70
commit
95b68b9542
18 files changed
+481
-107
No files matched your search
Vendored
+2
-2
@@ -31,7 +31,7 @@ namespace seafile::cache {
|
||||
/// 获取缓存值
|
||||
/// @param key 键
|
||||
/// @return 缓存值
|
||||
std::optional<V> get(const K &key) {
|
||||
std::optional<V> get(const K &key){
|
||||
// 第一阶段:读锁
|
||||
{
|
||||
std::shared_lock lock(mutex_);
|
||||
@@ -93,7 +93,7 @@ namespace seafile::cache {
|
||||
|
||||
///缓存大小
|
||||
size_t size() const {
|
||||
std::unique_lock lock(mutex_);
|
||||
std::shared_lock lock(mutex_);
|
||||
return cache_.size();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user