1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.esigate.cache;
16
17 import java.io.IOException;
18 import java.util.Properties;
19
20 import org.apache.http.client.cache.HttpCacheEntry;
21 import org.apache.http.client.cache.HttpCacheStorage;
22 import org.apache.http.client.cache.HttpCacheUpdateCallback;
23 import org.apache.http.client.cache.HttpCacheUpdateException;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 public abstract class CacheStorage implements HttpCacheStorage {
28 private static final Logger LOG = LoggerFactory.getLogger(CacheStorage.class);
29
30 public abstract void init(Properties properties);
31
32 private HttpCacheStorage impl;
33
34 @Override
35 public void putEntry(String key, HttpCacheEntry entry) throws IOException {
36 LOG.debug("putEntry({},{})", key, entry);
37 impl.putEntry(key, entry);
38 }
39
40 @Override
41 public HttpCacheEntry getEntry(String key) throws IOException {
42 LOG.debug("getEntry({})", key);
43 return impl.getEntry(key);
44 }
45
46 @Override
47 public void removeEntry(String key) throws IOException {
48 LOG.debug("removeEntry({})", key);
49 impl.removeEntry(key);
50
51 }
52
53 @Override
54 public void updateEntry(String key, HttpCacheUpdateCallback callback) throws IOException, HttpCacheUpdateException {
55 LOG.debug("updateEntry({},{})", key, callback);
56 impl.updateEntry(key, callback);
57 }
58
59 public void setImpl(HttpCacheStorage impl) {
60 this.impl = impl;
61 }
62
63 }