PageRenderTime 22ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/hazelcast/src/main/java/com/hazelcast/core/MapStore.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 68 lines | 9 code | 6 blank | 53 comment | 0 complexity | 5f9c94111c45f3e46a7a254dad977618 MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License");
 5 * you may not use this file except in compliance with the License.
 6 * You may obtain a copy of the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.hazelcast.core;
18
19import java.util.Collection;
20import java.util.Map;
21
22/**
23 * Hazelcast distributed map implementation is an in-memory data store but
24 * it can be backed by any type of data store such as RDBMS, OODBMS, or simply
25 * a file based data store.
26 * <p/>
27 * IMap.put(key, value) normally stores the entry into JVM's memory. If MapStore
28 * implementation is provided then Hazelcast can also call the MapStore
29 * implementation to store the entry into a user defined storage such as
30 * RDBMS or some other external storage system. It is completely up to the user
31 * how the key-value will be stored or deleted.
32 * <p/>
33 * Same goes for IMap.remove(key)
34 * <p/>
35 * Store implementation can be called synchronously (write-through)
36 * or asynchronously (write-behind) depending on the configuration.
37 */
38public interface MapStore<K, V> extends MapLoader<K, V> {
39    /**
40     * Stores the key-value pair.
41     *
42     * @param key   key of the entry to store
43     * @param value value of the entry to store
44     */
45    void store(K key, V value);
46
47    /**
48     * Stores multiple entries. Implementation of this method can optimize the
49     * store operation by storing all entries in one database connection for instance.
50     *
51     * @param map map of entries to store
52     */
53    void storeAll(Map<K, V> map);
54
55    /**
56     * Deletes the entry with a given key from the store.
57     *
58     * @param key key to delete from the store.
59     */
60    void delete(K key);
61
62    /**
63     * Deletes multiple entries from the store.
64     *
65     * @param keys keys of the entries to delete.
66     */
67    void deleteAll(Collection<K> keys);
68}