1. You can set expiry policy in CacheConfiguration so that entries inserted
with DataStreamer are also affected,
see
https://stackoverflow.com/questions/63463142/apache-ignite-net-getdatastreamer-withexpirypolicy

2. Compiler error says it all. Generic arguments don't match.
Try changing
MyStreamReceiver : IStreamReceiver<string, object>
to
MyStreamReceiver<T> : IStreamReceiver<string, T>

On Thu, May 26, 2022 at 5:24 PM Charlin S <charli...@hotelhub.com> wrote:

> 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