Skip to content

Commit 8d7d244

Browse files
Create README.md
1 parent 7016e94 commit 8d7d244

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Java SimpleCache
2+
3+
The Java SimpleCache Class is an easy way to cache 3rd party API calls.
4+
5+
## Usage
6+
7+
A very basic usage example:
8+
9+
```java
10+
SimpleCache cache = new SimpleCache();
11+
String data = cache.get_data('label', 'http://some.api.com/file.json');
12+
System.out.println(data);
13+
```
14+
15+
A more advanced example:
16+
17+
```java
18+
SimpleCache cache = new SimpleCache();
19+
cache.set_cache_time(3);
20+
cache.set_cache_path("cache/");
21+
cache.set_cache_extension(".json");
22+
23+
String data = null;
24+
25+
if(cache.get_cache("label") != null) {
26+
data = cache.get_cache("label");
27+
} else {
28+
data = cache.grab_url("http://some.api.com/file.json");
29+
cache.set_cache("label", data);
30+
}
31+
32+
System.out.println(data);
33+
```
34+
35+
## Credits
36+
37+
SimpleCache Caching Class Originally published in PHP by [Gilbert Pellegrom](https://github.com/gilbitron/PHP-SimpleCache). Ported to Java by me :)

0 commit comments

Comments
 (0)