0

I have a scenario where for my azure redis cache key to be unique. I'm inclined to use a value consisting of "<tenant guid>-<user guid>-<audience uri>-<issued at unix epoc time>", e.g.

cacheId = "90ebc5d3-7129-4a12-aabb-9f6ba00e47b5-58355802-a2e4-4b4c8ce1-df979ac4e8dc-http://targetresource.com/-1454185279"

Any thoughts on whether or not use of an azure redis cache key of this format or length will create issues?

cache.StringSet(cacheId, jwt, timeSpanOfNowUntilJwtExpiresEpocTime);  
. . .   
var userIdTokenCache = cache.StringGet(cacheId);  
if (userIdTokenCache.HasValue) { . . . } else { . . . }
myusrn
  • 1,050
  • 2
  • 15
  • 29
  • YMMV, but [this unofficial benchmarking](http://adamnengland.com/2012/11/15/redis-performance-does-key-length-matter/) shows no/minimal `write` performance degradation below 10k-character `KEY`, and little to no `read` degradation below 100-character `KEY`. So, that should be totally fine. – dwanderson Apr 10 '18 at 18:51

1 Answers1

0

I've implemented this and so far no issues surfaced so it would appear redis cache is okay with cache keys of this format and length.

myusrn
  • 1,050
  • 2
  • 15
  • 29