usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [26/36] usergrid git commit: Added a put that will automatically invalidate the cache.
Date Fri, 08 Apr 2016 20:21:13 GMT
Added a put that will automatically invalidate the cache.


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

Branch: refs/heads/release-2.1.1
Commit: f4769e6b526059fc328f71d60f0985425a254b3b
Parents: 78bba1a
Author: George Reyes <grey@apache.org>
Authored: Wed Mar 30 17:36:36 2016 -0700
Committer: George Reyes <grey@apache.org>
Committed: Wed Mar 30 17:36:36 2016 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/corepersistence/CpEntityManager.java   | 5 ++---
 .../usergrid/corepersistence/index/IndexSchemaCache.java       | 3 ++-
 .../usergrid/corepersistence/index/IndexSchemaCacheImpl.java   | 6 ++++++
 .../usergrid/corepersistence/index/ReIndexServiceImpl.java     | 3 +--
 4 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/f4769e6b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 968d91d..642b837 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -1789,9 +1789,8 @@ public class CpEntityManager implements EntityManager {
         schemaMap.putAll( properties );
 
         //TODO: we have to update then invalidate previous entry.
-        mm.putString( collectionName,JsonUtils.mapToJsonString( schemaMap ) );
-        indexSchemaCache.evictCollectionSchema( collectionName );
-
+        indexSchemaCache.putCollectionSchema( collectionName, JsonUtils.mapToJsonString(
schemaMap ) );
+        
         return schemaMap;
 
     }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f4769e6b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCache.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCache.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCache.java
index 5a9e95d..6fbe148 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCache.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCache.java
@@ -17,7 +17,6 @@
 package org.apache.usergrid.corepersistence.index;
 
 
-import java.util.Map;
 import java.util.Optional;
 
 
@@ -30,6 +29,8 @@ public interface IndexSchemaCache {
      */
     public Optional<String> getCollectionSchema(String collectionName);
 
+    void putCollectionSchema( String collectionName, String collectionSchema );
+
     /**
      * Evict the collection schema from the cache.
      * @param collectionName

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f4769e6b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCacheImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCacheImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCacheImpl.java
index 90c07bf..9e57480 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCacheImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexSchemaCacheImpl.java
@@ -79,6 +79,12 @@ public class IndexSchemaCacheImpl implements IndexSchemaCache {
         return null;
     }
 
+    @Override
+    public void putCollectionSchema(final String collectionName ,final String collectionSchema){
+        mapManager.putString( collectionName, collectionSchema );
+        evictCollectionSchema( collectionName );
+    }
+
 
     @Override
     public void evictCollectionSchema( final String collectionName ) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/f4769e6b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
index 559e117..591fcd6 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
@@ -158,8 +158,7 @@ public class ReIndexServiceImpl implements ReIndexService {
 
                 jsonMapData.put( "lastReindexed", Instant.now().toEpochMilli() );
                 //should probably roll this into the cache.
-                collectionMapStorage.putString( collectionName,JsonUtils.mapToJsonString(jsonMapData
)  );
-                indexSchemaCache.evictCollectionSchema( collectionName );
+                indexSchemaCache.putCollectionSchema( collectionName, JsonUtils.mapToJsonString(jsonMapData
) );
             }
 
         }


Mime
View raw message