Azure / azure-cosmosdb-java

Java Async SDK for SQL API of Azure Cosmos DB
MIT License
54 stars 61 forks source link

WIP Creates an expirable cache #46

Closed otaviojava closed 6 years ago

otaviojava commented 6 years ago

This PR contains a cache that expires from given a specific value. To make this cache easier to use, it implements the Map interface.

   Map<String, Integer> map = TTLCache.of(2, TimeUnit.MILLISECONDS);
   map.put("one", 1);
   Integer value = map.get("one");
   TimeUnit.MILLISECONDS.sleep(3L);
   value = map.get("one");//it will be null