Example of expiration with the cache interface
For example, assume the following configuration: Â // this entry will expire in 1000 millis cache.put("pinot noir", pinotNoirPrice); Â // this entry will expire in 2000 millis cache.put("chardonnay", chardonnayPrice, 2, TimeUnit.SECONDS); Â // this entry will expire 1000 millis after it is last accessed cache.put("pinot grigio", pinotGrigioPrice, -1, Â Â Â Â Â Â Â Â Â TimeUnit.SECONDS, 1, TimeUnit.SECONDS); Â // this entry will expire 1000 millis after it is last accessed, or // in 5000 millis, which ever triggers first cache.put("riesling", rieslingPrice, 5, Â Â Â Â Â Â Â Â Â TimeUnit.SECONDS, 1, TimeUnit.SECONDS);