aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTQueryCache.h
diff options
context:
space:
mode:
authorGravatar Greg Soltis <gsoltis@google.com>2018-02-13 11:12:17 -0800
committerGravatar GitHub <noreply@github.com>2018-02-13 11:12:17 -0800
commit5f5f80825820487e1c7ed964c94a472e84adc552 (patch)
tree57ff66e437adc598a29976d24d6e14a5e9d57043 /Firestore/Source/Local/FSTQueryCache.h
parentc7c51a72d2c08284d3054730f6d40f86c9d579e2 (diff)
Keep track of number of queries in the query cache (#776)
* Implement schema versions * Style fixes * newlines, copyrights, assumptions * Fix nullability * Raw ptr -> shared_ptr * kVersionTableGlobal -> kVersionGlobalTable * Drop utils, move into static methods * Drop extra include * Add a few more comments * Move version constant into migrations file * formatting? * Fix comment * Split add and update queryData * Work on adding targetCount * More work on count * Using shared_ptr * Implement count for query cache * use quotes * Add cast * Styling * Revert year bump in copyright * Add adversarial key to migration test * Add comment * Fix style
Diffstat (limited to 'Firestore/Source/Local/FSTQueryCache.h')
-rw-r--r--Firestore/Source/Local/FSTQueryCache.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/Firestore/Source/Local/FSTQueryCache.h b/Firestore/Source/Local/FSTQueryCache.h
index 88c9df9..5c43de4 100644
--- a/Firestore/Source/Local/FSTQueryCache.h
+++ b/Firestore/Source/Local/FSTQueryCache.h
@@ -78,18 +78,29 @@ NS_ASSUME_NONNULL_BEGIN
group:(FSTWriteGroup *)group;
/**
- * Adds or replaces an entry in the cache.
+ * Adds an entry in the cache.
*
- * The cache key is extracted from `queryData.query`. If there is already a cache entry for the
- * key, it will be replaced.
+ * The cache key is extracted from `queryData.query`. The key must not already exist in the cache.
*
- * @param queryData An FSTQueryData instance to put in the cache.
+ * @param queryData A new FSTQueryData instance to put in the cache.
*/
- (void)addQueryData:(FSTQueryData *)queryData group:(FSTWriteGroup *)group;
+/**
+ * Updates an entry in the cache.
+ *
+ * The cache key is extracted from `queryData.query`. The entry must already exist in the cache,
+ * and it will be replaced.
+ * @param queryData An FSTQueryData instance to replace an existing entry in the cache
+ */
+- (void)updateQueryData:(FSTQueryData *)queryData group:(FSTWriteGroup *)group;
+
/** Removes the cached entry for the given query data (no-op if no entry exists). */
- (void)removeQueryData:(FSTQueryData *)queryData group:(FSTWriteGroup *)group;
+/** Returns the number of targets cached. */
+- (int32_t)count;
+
/**
* Looks up an FSTQueryData entry in the cache.
*