How do I log from cache #1921
-
How do I log what is being put into or gotten from the cache? |
Beta Was this translation helpful? Give feedback.
Answered by
peter-csala
Jan 30, 2024
Replies: 1 comment 7 replies
-
Here you can see when these above two delegates are being called. Policy.Cache(
cacheProvider: /* the chosen cache provider */,
ttl: /* time to live timespan */,
onCacheGet: (_, key) => Logger.Info("Hit {key}", key),
onCacheMiss: (_, __) => {},
onCachePut: (_, key) => Logger.Info("Put {key}", key),
onCacheGetError: null,
onCachePutError: null
); |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@dayadam After the put. See line 56 and 57:
Polly/src/Polly/Caching/CacheEngine.cs
Line 56 in 51044c5
Polly/src/Polly/Caching/CacheEngine.cs
Line 57 in 51044c5