From 0fbd0eac80961918f53d1f0395bba74ecee05ea3 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sat, 25 Jul 2020 21:37:28 +0900 Subject: [PATCH] Change default stat_cache_expire Previously s3fs cached files forever which confused users with creating objects using another client. --- doc/man/s3fs.1 | 4 ++-- src/cache.cpp | 2 +- src/s3fs_util.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/man/s3fs.1 b/doc/man/s3fs.1 index d13dbe8..68a911f 100644 --- a/doc/man/s3fs.1 +++ b/doc/man/s3fs.1 @@ -158,10 +158,10 @@ specify the maximum number of keys returned by S3 list object API. The default i \fB\-o\fR max_stat_cache_size (default="100,000" entries (about 40MB)) maximum number of entries in the stat cache and symbolic link cache. .TP -\fB\-o\fR stat_cache_expire (default is no expire) +\fB\-o\fR stat_cache_expire (default is 900) specify expire time (seconds) for entries in the stat cache and symbolic link cache. This expire time indicates the time since cached. .TP -\fB\-o\fR stat_cache_interval_expire (default is no expire) +\fB\-o\fR stat_cache_interval_expire (default is 900) specify expire time (seconds) for entries in the stat cache and symbolic link cache. This expire time is based on the time from the last access time of those cache. This option is exclusive with stat_cache_expire, and is left for compatibility with older versions. .TP diff --git a/src/cache.cpp b/src/cache.cpp index 2f8b72a..8b6642e 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -160,7 +160,7 @@ pthread_mutex_t StatCache::stat_cache_lock; //------------------------------------------------------------------- // Constructor/Destructor //------------------------------------------------------------------- -StatCache::StatCache() : IsExpireTime(false), IsExpireIntervalType(false), ExpireTime(0), CacheSize(100000), IsCacheNoObject(false) +StatCache::StatCache() : IsExpireTime(false), IsExpireIntervalType(false), ExpireTime(15 * 60), CacheSize(100000), IsCacheNoObject(false) { if(this == StatCache::getStatCacheData()){ stat_cache.clear(); diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index 392032d..5fe7a20 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -1258,12 +1258,12 @@ void show_help () " - maximum number of entries in the stat cache, and this maximum is\n" " also treated as the number of symbolic link cache.\n" "\n" - " stat_cache_expire (default is no expire)\n" + " stat_cache_expire (default is 900))\n" " - specify expire time (seconds) for entries in the stat cache.\n" " This expire time indicates the time since stat cached. and this\n" " is also set to the expire time of the symbolic link cache.\n" "\n" - " stat_cache_interval_expire (default is no expire)\n" + " stat_cache_interval_expire (default is 900)\n" " - specify expire time (seconds) for entries in the stat cache(and\n" " symbolic link cache).\n" " This expire time is based on the time from the last access time\n"