A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/App-vNext/Polly/wiki/Anonymising-and-de-timestamping-cached-data below:

Anonymising and de timestamping cached data · App-vNext/Polly Wiki · GitHub

Using serializers to anonymise cached data or remove timestamps

Note

This documentation describes the previous Polly v7 API. If you are using the new v8 API, please refer to pollydocs.org.

ICacheItemSerializer<TResult, TSerialized> was introduced into Polly to allow CachePolicy to serialize values to storage formats required by individual cache providers. However, serializers can also be used for manipulating data on the way in to and out of cache, without necessarily transforming the format.

This can be useful for anonymising content stored in the cache, and ensuring that content served from cache does not present incorrect timestamps if these aspects are important to you or if there is any danger of them leaking to the consumer.

Example: HttpResponseMessage

A typical example might be if using CachePolicy in a call returning HttpResponseMessage. You may in this case want to:

Personal data or any data varying with the requester

The simple implementation for this is to make an ICacheItemSerializer<HttpResponseMessage, HttpResponseMessage>:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4