ptupitsyn commented on issue #11775:
URL: https://github.com/apache/ignite/issues/11775#issuecomment-2563437952
When you say `withExpiryPolicy`, no new cache is created. It is just a
reference to the same cache, but all write operations will set the specified
expiry for the entries.
```java
IgniteCache cache = ignite.cache("myCache");
cache.put(1, "a"); // No expiry
IgniteCache cacheWithExpiry = cache.withExpiryPolicy(new
CreatedExpiryPolicy(new Duration(TimeUnit.MINUTES, 5)));
System.out.println(cacheWithExpiry.get(1)); // Prints "a"
cacheWithExpiry.put(2, "b"); // Will expire in 5 min
System.out.println(cache.get(2)); // Prints "b"
cache.put(3, "c"); // Won't expire
cacheWithExpiry.put(4, "d"); // Will expire
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]