c# - Redis StackExchange cache performance -
i trying redis stackexchange alter provider azure , wondering on best setup.
considering next code
private static connectionmultiplexer connection = connectionmultiplexer.connect(...); public string get(string key) { idatabase cache = connection.getdatabase(); homecoming cache.stringget(key); } is getting of database going performance nail calling each time phone call cache made?
should managed way else?
should created lifetime of object not static?
what best practice around managing idatabase?
is getting of database going performance nail calling each time phone call cache made?
not noticeably so; as described here:
the object returned getdatabase inexpensive pass-thru object, , not need stored.
of course, can take store it, if wish. happens, - because utilize different database numbers (for different sites), , convenient store idatabase store int represents database number.
other that, though, don't need worry much - if allocate on-demand, still inexpensive collect etc.
the other thing worth saying may worth caching in-memory before touch redis: redis phone call fast, redis phone call that don't make faster.
c# .net redis stackexchange.redis
No comments:
Post a Comment