1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.jcs.jcache.extras.writer;
20
21 import javax.cache.Cache;
22 import javax.cache.configuration.Factory;
23 import javax.cache.integration.CacheWriter;
24 import javax.cache.integration.CacheWriterException;
25 import java.util.Collection;
26
27 public abstract class CacheWriterAdapter<K, V> implements CacheWriter<K, V>, Factory<CacheWriter<K, V>>
28 {
29 @Override
30 public void writeAll(final Collection<Cache.Entry<? extends K, ? extends V>> entries) throws CacheWriterException
31 {
32 for (final Cache.Entry<? extends K, ? extends V> entry : entries)
33 {
34 write(entry);
35 }
36 }
37
38 @Override
39 public void deleteAll(final Collection<?> keys) throws CacheWriterException
40 {
41 for (final Object k : keys)
42 {
43 delete(k);
44 }
45 }
46
47 @Override
48 public CacheWriter<K, V> create()
49 {
50 return this;
51 }
52 }