diff options
Diffstat (limited to 'staging_vespalib/src/vespa/vespalib/stllike/cache.hpp')
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/stllike/cache.hpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp b/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp index a8c7d16473c..1ba168fa77b 100644 --- a/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp +++ b/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp @@ -120,16 +120,17 @@ cache<P>::read(const K & key) template< typename P > void -cache<P>::write(const K & key, const V & value) +cache<P>::write(const K & key, V value) { vespalib::LockGuard storeGuard(getLock(key)); + _store.write(key, value); { vespalib::LockGuard guard(_hashLock); - (*this)[key] = value; - _sizeBytes += calcSize(key, value); + size_t sz = calcSize(key, value); + (*this)[key] = std::move(value); + _sizeBytes += sz; _write++; } - _store.write(key, value); } template< typename P > |