简体   繁体   English

有没有办法为我在 ignitecache 中插入的不同元素设置不同的到期时间?

[英]Is there a way to put up different expiry times for different elements I insert in ignitecache?

Can I insert elements having different expiry times like we have in ehcache我可以像在 ehcache 中那样插入具有不同到期时间的元素吗

For example:例如:

Cache: add element1 //expire after 5 seconds缓存:添加元素1 //5秒后过期

cache: add element2 //expire after 15 seconds cache: add element2 //15秒后过期

cache: add element3 //expire after 'x' seconds/minutes缓存:添加元素3 //在'x'秒/分钟后过期

If not, can you suggest any alternative cache to deal with the problem?如果没有,您能否建议任何替代缓存来处理该问题?

I intended to use ehcache as well but turns out it doesn't support active/eager expiry.我也打算使用ehcache,但事实证明它不支持主动/急切到期。

Cache entries have individual expiry policies, use IgniteCache.withExpiryPolicy :缓存条目有单独的过期策略,使用IgniteCache.withExpiryPolicy

cache.withExpiryPolicy(new CreatedExpiryPolicy(new Duration(SECONDS, 5))).put(1, 1);

cache.withExpiryPolicy(new CreatedExpiryPolicy(new Duration(SECONDS, 15))).put(2, 2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 放入oracleDB的不同方法-BatchUpdate - Different way to put into oracleDB - batchupdate Maven / TestNG / Selenium-我可以在一个testng.xml中设置多个测试套件,并在不同的时间运行不同的套件吗? - Maven/TestNG/Selenium - Can I set up multiple tests suites in one testng.xml and run different ones at different times? 我在Java中得到冒泡排序的运行时间不同 - I get different running times for bubblesort in Java 我多次包含具有不同属性的食谱 - I including a recipe multiple times with different attributes 如何将不同大小的元素立即放在彼此之上? - How do to put elements of different sizes immediately on top of one another? 从字符串中切出不同的元素并将其放入列表中 - Cut out different elements from a string and put them into a list 如何在不同的墙壁上放置不同的纹理? W - How do I put different textures on different walls? LWJGL JXLS。 如何将不同的收藏放在不同的工作表中? - JXLS. How can I put different collections in different sheets? 有没有办法创建一个具有不同的每个条目到期时间的缓存 - Is there a way to create a Cache with different expiration times per-entry 当我以不同的方法插入不同的扫描仪时出现异常 - Exception when I insert a different Scanner in different methods
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM