00001 /* 00002 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. 00003 * 00004 * Licensed under the Universal Permissive License v 1.0 as shown at 00005 * http://oss.oracle.com/licenses/upl. 00006 */ 00007 #ifndef COH_CACHE_STORE_HPP 00008 #define COH_CACHE_STORE_HPP 00009 00010 #include "coherence/lang.ns" 00011 00012 #include "coherence/net/cache/CacheLoader.hpp" 00013 #include "coherence/util/Collection.hpp" 00014 #include "coherence/util/Map.hpp" 00015 00016 COH_OPEN_NAMESPACE3(coherence,net,cache) 00017 00018 using coherence::util::Collection; 00019 using coherence::util::Map; 00020 00021 00022 /** 00023 * A cache store. 00024 * 00025 * @author jh 2008.03.12 00026 */ 00027 class COH_EXPORT CacheStore 00028 : public interface_spec<CacheStore, 00029 implements<CacheLoader> > 00030 { 00031 // ----- CacheStore interface ------------------------------------------- 00032 00033 public: 00034 /** 00035 * Store the specified value under the specified key in the underlying 00036 * store. This method is intended to support both key/value creation 00037 * and value update for a specific key. 00038 * 00039 * @param vKey key to store the value under 00040 * @param ohValue value to be stored 00041 * 00042 * @throws UnsupportedOperationException if this implementation or the 00043 * underlying store is read-only 00044 */ 00045 virtual void store(Object::View vKey, Object::Holder ohValue) = 0; 00046 00047 /** 00048 * Store the specified values under the specified keys in the 00049 * underlying store. This method is intended to support both key/value 00050 * creation and value update for the specified keys. 00051 * 00052 * @param vMapEntries a Map of any number of keys and values to store 00053 * 00054 * @throws UnsupportedOperationException if this implementation or the 00055 * underlying store is read-only 00056 */ 00057 virtual void storeAll(Map::View vMapEntries) = 0; 00058 00059 /** 00060 * Remove the specified key from the underlying store if present. 00061 * 00062 * @param vKey key whose mapping is being removed from the cache 00063 * 00064 * @throws UnsupportedOperationException if this implementation or the 00065 * underlying store is read-only 00066 */ 00067 virtual void erase(Object::View vKey) = 0; 00068 00069 /** 00070 * Remove the specified keys from the underlying store if present. 00071 * 00072 * @param vColKeys keys whose mappings are being removed from the 00073 * cache 00074 * 00075 * @throws UnsupportedOperationException if this implementation or the 00076 * underlying store is read-only 00077 */ 00078 virtual void eraseAll(Collection::View vColKeys) = 0; 00079 }; 00080 00081 COH_CLOSE_NAMESPACE3 00082 00083 #endif // COH_CACHE_STORE_HPP