00001 /* 00002 * CacheStore.hpp 00003 * 00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_CACHE_STORE_HPP 00017 #define COH_CACHE_STORE_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/net/cache/CacheLoader.hpp" 00022 #include "coherence/util/Collection.hpp" 00023 #include "coherence/util/Map.hpp" 00024 00025 COH_OPEN_NAMESPACE3(coherence,net,cache) 00026 00027 using coherence::util::Collection; 00028 using coherence::util::Map; 00029 00030 00031 /** 00032 * A cache store. 00033 * 00034 * @author jh 2008.03.12 00035 */ 00036 class COH_EXPORT CacheStore 00037 : public interface_spec<CacheStore, 00038 implements<CacheLoader> > 00039 { 00040 // ----- CacheStore interface ------------------------------------------- 00041 00042 public: 00043 /** 00044 * Store the specified value under the specified key in the underlying 00045 * store. This method is intended to support both key/value creation 00046 * and value update for a specific key. 00047 * 00048 * @param vKey key to store the value under 00049 * @param ohValue value to be stored 00050 * 00051 * @throws UnsupportedOperationException if this implementation or the 00052 * underlying store is read-only 00053 */ 00054 virtual void store(Object::View vKey, Object::Holder ohValue) = 0; 00055 00056 /** 00057 * Store the specified values under the specified keys in the 00058 * underlying store. This method is intended to support both key/value 00059 * creation and value update for the specified keys. 00060 * 00061 * @param vMapEntries a Map of any number of keys and values to store 00062 * 00063 * @throws UnsupportedOperationException if this implementation or the 00064 * underlying store is read-only 00065 */ 00066 virtual void storeAll(Map::View vMapEntries) = 0; 00067 00068 /** 00069 * Remove the specified key from the underlying store if present. 00070 * 00071 * @param vKey key whose mapping is being removed from the cache 00072 * 00073 * @throws UnsupportedOperationException if this implementation or the 00074 * underlying store is read-only 00075 */ 00076 virtual void erase(Object::View vKey) = 0; 00077 00078 /** 00079 * Remove the specified keys from the underlying store if present. 00080 * 00081 * @param vColKeys keys whose mappings are being removed from the 00082 * cache 00083 * 00084 * @throws UnsupportedOperationException if this implementation or the 00085 * underlying store is read-only 00086 */ 00087 virtual void eraseAll(Collection::View vColKeys) = 0; 00088 }; 00089 00090 COH_CLOSE_NAMESPACE3 00091 00092 #endif // COH_CACHE_STORE_HPP