Skip to content
This repository was archived by the owner on Jul 22, 2021. It is now read-only.

Commit 4d08887

Browse files
committed
Update README.md
1 parent 8b64a1d commit 4d08887

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,15 @@ Database lifetimeCachedDb = new DatabaseCacheWithLifetimes(db, cache, 1, TimeUni
8989
// Wrap the same database and cache instances multiple times with different lifetimes to easily set
9090
// different lifetimes for different objects.
9191
```
92-
92+
### Directly accessing caches from an application program
93+
Caches can be directly accessed and modified using the methods of com.cloudant.client.cache.Cache and com.cloudant.client.cache.CacheWithLifetimes. For example, the following method call adds "object1" with key “key1” to the cache. “lifetime” is the lifetime of the cached value in milliseconds:
94+
```java
95+
cache.put(key1, object1, lifetime);
96+
```
97+
The following method call deletes the object indexed by "key2" from the cache if it exists:
98+
```java
99+
cache.delete(key2);
100+
```
93101
## Related documentation
94102
* [API reference (javadoc)](http://www.javadoc.io/doc/com.cloudant/cloudant-client-cache/)
95103
* [In-process cache API reference (javadoc)](http://www.javadoc.io/doc/com.cloudant/cloudant-client-cache-in-process/)

0 commit comments

Comments
 (0)