Ejemplo n.º 1
0
 public void AddOrUpdate(CacheKey key, TimedEntityTagHeaderValue eTag)
 {
     var cacheKey = TryGetPersistentCacheKey(key.HashBase64);
     if (cacheKey != null)
     {
         // update existing
         cacheKey.ETag = eTag.Tag;
         cacheKey.LastModified = eTag.LastModified;
     }
     else
     {
         // Create new
         cacheKey = new PersistentCacheKey
         {
             Id = key.HashBase64,
             RoutePattern = key.RoutePattern,
             ETag = eTag.Tag,
             LastModified = eTag.LastModified,
             ResourceUri = key.ResourceUri
         };
     }
     _elasticsearchClient.Index(cacheKey, PersistentCacheKey.SearchIndex, ElasticsearchIndex);
 }
Ejemplo n.º 2
0
        public void AddOrUpdate(CacheKey key, TimedEntityTagHeaderValue eTag)
        {
            var cacheKey = TryGetPersistentCacheKey(key.HashBase64);

            if (cacheKey != null)
            {
                // update existing
                cacheKey.ETag         = eTag.Tag;
                cacheKey.LastModified = eTag.LastModified;
            }
            else
            {
                // Create new
                cacheKey = new PersistentCacheKey
                {
                    Id           = key.HashBase64,
                    RoutePattern = key.RoutePattern,
                    ETag         = eTag.Tag,
                    LastModified = eTag.LastModified,
                    ResourceUri  = key.ResourceUri
                };
            }
            _elasticsearchClient.Index(cacheKey, d => d.Index(ElasticsearchIndex));
        }