We have a requirement to set data to expire after some time.
I set the WithExpiryPolicy for cache instance, but the data added by
GetDataStreamer does not expire, due to it returning a new instance with
default policies.
So I am trying to use IStreamReceiver but not able to build the solution.

IStreamReceiver  Code:
 public  class MyStreamReceiver : IStreamReceiver<string, object>
    {
        public void Receive(ICache<string, object> cache,
ICollection<ICacheEntry<string, object>> entries)
        {
            foreach (var entry in entries)
            {
                cache.WithExpiryPolicy(new
ExpiryPolicy(TimeSpan.FromSeconds(600), null, null)).Put(entry.Key,
entry.Value);
            }
        }
    }

Datastreamer code error
[image: image.png]

How to implement IStreamReceiver. Please help me on this.
Regards,
Charlin

Reply via email to