diff --git a/Nancy.LightningCache/CacheKey/DefaultCacheKeyGenerator.cs b/Nancy.LightningCache/CacheKey/DefaultCacheKeyGenerator.cs index 5661531..07eb36e 100644 --- a/Nancy.LightningCache/CacheKey/DefaultCacheKeyGenerator.cs +++ b/Nancy.LightningCache/CacheKey/DefaultCacheKeyGenerator.cs @@ -43,7 +43,7 @@ public string Get(Request request) } } - var removeParamKeys = query.Where(a => !_varyParams.Contains(a.Key.Replace("?", "").ToLower())).Select(a => a.Key).ToArray(); + var removeParamKeys = query.Where(a => !_varyParams.Contains(a.Key.Replace("?", ""), StringComparer.OrdinalIgnoreCase)).Select(a => a.Key).ToArray(); foreach (var removeParamKey in removeParamKeys) query.Remove(removeParamKey); diff --git a/Nancy.LightningCache/CacheStore/DiskCacheStore.cs b/Nancy.LightningCache/CacheStore/DiskCacheStore.cs index 5db70a5..31b5100 100644 --- a/Nancy.LightningCache/CacheStore/DiskCacheStore.cs +++ b/Nancy.LightningCache/CacheStore/DiskCacheStore.cs @@ -73,7 +73,7 @@ public DiskCacheStore(string cacheDirectory) private static string Hash(string str) { var hasher = SHA256.Create(); - var inputBytes = Encoding.ASCII.GetBytes(str); + var inputBytes = Encoding.ASCII.GetBytes(str.ToLower()); var hashBytes = hasher.ComputeHash(inputBytes); var sb = new StringBuilder(); diff --git a/Nancy.LightningCache/CacheStore/WebCacheStore.cs b/Nancy.LightningCache/CacheStore/WebCacheStore.cs index 14b51e4..c33ef1e 100644 --- a/Nancy.LightningCache/CacheStore/WebCacheStore.cs +++ b/Nancy.LightningCache/CacheStore/WebCacheStore.cs @@ -19,7 +19,7 @@ public CachedResponse Get(string key) if (_cache == null) return null; - var response = _cache.Get(key) as SerializableResponse; + var response = _cache.Get(key.ToLower()) as SerializableResponse; if (response == null) return null; @@ -34,7 +34,7 @@ public void Remove(string key) if (_cache == null) return; - _cache.Remove(key); + _cache.Remove(key.ToLower()); } public void Set(string key, NancyContext context, DateTime absoluteExpiration) @@ -44,7 +44,7 @@ public void Set(string key, NancyContext context, DateTime absoluteExpiration) if(_cache == null) return; - _cache[key] = new SerializableResponse(context.Response, absoluteExpiration); + _cache[key.ToLower()] = new SerializableResponse(context.Response, absoluteExpiration); } private static readonly object Lock = new object();