You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by db...@apache.org on 2014/11/13 04:48:49 UTC

cassandra git commit: create the cache name format only once

Repository: cassandra
Updated Branches:
  refs/heads/trunk 88d4a14a8 -> 938248640


create the cache name format only once


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/93824864
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/93824864
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/93824864

Branch: refs/heads/trunk
Commit: 93824864022825c5a22d000e78afe86ea5aed796
Parents: 88d4a14
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Wed Nov 12 22:45:32 2014 -0500
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Wed Nov 12 22:47:06 2014 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cache/AutoSavingCache.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/93824864/src/java/org/apache/cassandra/cache/AutoSavingCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/AutoSavingCache.java b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
index 9a79e38..4ac2328 100644
--- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java
+++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
@@ -306,13 +306,14 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
             File[] files = savedCachesDir.listFiles();
             if (files != null)
             {
+                String cacheNameFormat = String.format("%s-%s.db", cacheType.toString(), CURRENT_VERSION);
                 for (File file : files)
                 {
                     if (!file.isFile())
                         continue; // someone's been messing with our directory.  naughty!
 
-                    if (file.getName().endsWith(cacheType.toString())
-                            || file.getName().endsWith(String.format("%s-%s.db", cacheType.toString(), CURRENT_VERSION)))
+                    if (file.getName().endsWith(cacheNameFormat) 
+                     || file.getName().endsWith(cacheType.toString()))
                     {
                         if (!file.delete())
                             logger.warn("Failed to delete {}", file.getAbsolutePath());