/// <summary>
 ///     Returns the last time the cache was refreshed.
 /// </summary>
 /// <param name="cacheType"></param>
 /// <param name="cacheKey"></param>
 /// <returns></returns>
 public long GetLastCacheUpdateTime(string cacheType, string cacheKey)
 {
     if (String.IsNullOrWhiteSpace(cacheType) || String.IsNullOrWhiteSpace(cacheKey) ||
         !DoesCacheExist(cacheType))
     {
         return(0);
     }
     try
     {
         QuerySpec querySpec = QuerySpec.BuildExactQuerySpec(cacheType, CacheKey, cacheKey, 1);
         JArray    results   = _smartStore.Query(querySpec, 0);
         if (results != null && results.Count > 0)
         {
             var jObj = results[0].Value <JObject>();
             if (jObj != null)
             {
                 return(jObj.ExtractValue <long>(SmartStore.Store.SmartStore.SoupLastModifiedDate));
             }
         }
     }
     catch (SmartStoreException)
     {
         Debug.WriteLine("SmartStoreException occurred while attempting to read last cached time");
     }
     return(0);
 }
Beispiel #2
0
        internal HashSet <string> GetDirtyRecordIds(string soupName, string idField)
        {
            var    idsToSkip       = new HashSet <string>();
            string dirtyRecordsSql = string.Format("SELECT {{{0}:{1}}} FROM {{{2}}} WHERE {{{3}:{4}}} = 'True'",
                                                   soupName,
                                                   idField, soupName, soupName, Local);
            QuerySpec smartQuerySpec = QuerySpec.BuildSmartQuerySpec(dirtyRecordsSql, PageSize);
            bool      hasMore        = true;

            for (int pageIndex = 0; hasMore; pageIndex++)
            {
                JArray results = _smartStore.Query(smartQuerySpec, pageIndex);
                hasMore = (results.Count == PageSize);
                idsToSkip.UnionWith(ToSet(results));
            }
            return(idsToSkip);
        }