The entry would be marked as expired, but not necessarily removed. Removal of expired entries happens in one of 2 ways:
1. You try and do a get() or containsKey() for that entry. The entry is then detected as expired and is removed.
2. You have enabled eviction and an eviction thread wakes up periodically and purges expired entries.
If you have not enabled (2), or your eviction thread wakeup interval is large and you probe jconsole before the eviction thread kicks in, you will still see the expired entry. You can be assured that if you tried to retrieve the entry via a get() or containsKey() though, you won't see the entry (and the entry will be removed).
You can also force eviction through:
There's also an Cache.evict(k) method, that does eviction on a single key.
and now it works