RiakCacheStore extends AbstractBinaryEntryStore { public RiakCacheStore(String bucket) throws IOException { this(DEFAULT_HOST, DEFAULT_PORT, bucket); } RiakCacheStore(String bucket);  RiakCacheStore(String host, int port, String bucket); @Override void load(BinaryEntry entry); @Override void store(BinaryEntry entry); @Override void erase(BinaryEntry entry); static final String DEFAULT_HOST; static final int DEFAULT_PORT; }
@Test public void testRiakCacheStore() throws IOException { NamedCache countries1 = CacheFactory.getCache("riak-store-countries-1"); Loader loader = new CsvToCoherence("countries.csv", countries1, Country.class); long start = System.currentTimeMillis(); loader.load(); long duration = System.currentTimeMillis() - start; System.out.println("Written " + countries1.size() + " objects to Riak in " + duration + " ms"); assertEquals(244, countries1.size()); start = System.currentTimeMillis(); List keys = getBucketKeys(countries1.getCacheService().getSerializer()); duration = System.currentTimeMillis() - start; System.out.println("Retrieved " + keys.size() + " bucket keys in " + duration + " ms"); NamedCache countries2 = CacheFactory.getCache("riak-store-countries-2"); start = System.currentTimeMillis(); countries2.invokeAll(keys, new PreloadRequest()); duration = System.currentTimeMillis() - start; System.out.println("Loaded " + countries2.size() + " objects from Riak in " + duration + " ms"); assertEquals(244, countries2.size()); }