Last active
August 29, 2015 14:07
Star
You must be signed in to star a gist
Azure Redis Cache - Cache StringGet/StringSet with Serialization/Deserialization to Custom .Net Type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cacheItem = CacheSerializer.Deserialize<Guid>(cache.StringGet(cacheKey)); | |
if (cacheItem == Guid.Empty) | |
{ | |
// Cache item doesn't exist, retrieve Guid from source system. | |
// Add (serialized) Guid to the Azure Redis Cache with a lifespan of 90 minutes | |
cache.StringSet(cacheKey, CacheSerializer.Serialize(cacheItem), TimeSpan.FromMinutes(90)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment