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

Commit 2ebfd50

Browse files
committed
Merge pull request #4 from aruniyengar/master
Update Documentation
2 parents 9509b26 + 4d08887 commit 2ebfd50

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ dependencies {
3131
compile group: 'com.cloudant', name: 'cloudant-client-cache-in-process', version: 'latest.release'
3232
}
3333
```
34+
In these examples, the cache will run in the same process as the application.
3435
* Redis cache: **cloudant-client-cache-redis** (depends on cloudant-client-cache). Provides a
3536
`com.cloudant.client.cache.CacheWithLifetimes` implementation that uses a Redis instance as the store.
3637
```groovy
3738
dependencies {
3839
compile group: 'com.cloudant', name: 'cloudant-client-cache-redis', version: 'latest.release'
3940
}
4041
```
41-
42+
In this example, Redis must be running in another process. Information about Redis, including download information, is available from:
43+
http://redis.io/
4244
### Instantiate a cache
4345

4446
* `com.cloudant.client.cache.LRUCache`:
@@ -87,7 +89,15 @@ Database lifetimeCachedDb = new DatabaseCacheWithLifetimes(db, cache, 1, TimeUni
8789
// Wrap the same database and cache instances multiple times with different lifetimes to easily set
8890
// different lifetimes for different objects.
8991
```
90-
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+
```
91101
## Related documentation
92102
* [API reference (javadoc)](http://www.javadoc.io/doc/com.cloudant/cloudant-client-cache/)
93103
* [In-process cache API reference (javadoc)](http://www.javadoc.io/doc/com.cloudant/cloudant-client-cache-in-process/)

0 commit comments

Comments
 (0)