@@ -27,30 +27,33 @@ limitations under the License.
2727namespace photon {
2828namespace fs {
2929
30- ICachedFileSystem *new_full_file_cached_fs (IFileSystem *srcFs, IFileSystem *mediaFs,
30+ ICachedFileSystem *new_full_file_cached_fs (IFileSystem *srcFs, IFileSystem *mediaFs,
3131 uint64_t refillUnit, uint64_t capacityInGB,
3232 uint64_t periodInUs, uint64_t diskAvailInBytes,
3333 IOAlloc *allocator, int quotaDirLevel,
34- CacheFnTransFunc fn_trans_func) {
34+ CacheFnTransFunc fn_trans_func,
35+ uint64_t storeCacheTTLUsecs) {
3536 if (refillUnit % 4096 != 0 || !is_power_of_2 (refillUnit)) {
3637 LOG_ERROR_RETURN (EINVAL, nullptr , " refill Unit need to be aligned to 4KB and power of 2" )
3738 }
3839 if (!allocator) {
3940 allocator = new IOAlloc;
4041 }
4142 FileCachePool *pool = nullptr ;
42- pool =
43- new FileCachePool (mediaFs, capacityInGB, periodInUs, diskAvailInBytes, refillUnit);
43+ pool = new FileCachePool (mediaFs, capacityInGB, periodInUs, diskAvailInBytes,
44+ refillUnit, storeCacheTTLUsecs );
4445 pool->Init ();
4546 return new_cached_fs (srcFs, pool, 4096 , allocator, fn_trans_func);
4647}
4748
4849using OC = ObjectCache<std::string, ICacheStore*>;
49- ICachePool::ICachePool (uint32_t pool_size, uint32_t max_refilling, uint32_t refilling_threshold, bool pin_write)
50- : m_stores(new OC(10UL * 1000 * 1000 )),
51- m_max_refilling (max_refilling),
52- m_refilling_threshold(refilling_threshold),
53- m_pin_write(pin_write) {
50+ ICachePool::ICachePool (uint32_t pool_size, uint32_t max_refilling,
51+ uint32_t refilling_threshold, bool pin_write,
52+ uint64_t store_cache_ttl_usecs)
53+ : m_stores(new OC(store_cache_ttl_usecs)),
54+ m_max_refilling (max_refilling),
55+ m_refilling_threshold(refilling_threshold),
56+ m_pin_write(pin_write) {
5457 if (pool_size != 0 ) {
5558 m_thread_pool = photon::new_thread_pool (pool_size, 128 * 1024UL );
5659 m_vcpu = photon::get_vcpu ();
0 commit comments