BUG-6650: ep-ip/sgt, update/rename models and yangs for sxp-ise-adapter
[groupbasedpolicy.git] / sxp-mapper / src / main / java / org / opendaylight / groupbasedpolicy / sxp / mapper / api / SimpleCachedDao.java
1 /**
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.groupbasedpolicy.sxp.mapper.api;
9
10 import javax.annotation.Nonnull;
11 import javax.annotation.Nullable;
12
13 /**
14  * Purpose: encapsulate access to DS by exposing
15  * <dl>
16  * <dt>find</dt>
17  * <dd>search through cached values</dd>
18  * <dt>update</dt>
19  * <dd>stores given pair (key, value) to local cache</dd>
20  * </dl>
21  *
22  * @param <K> data key type
23  * @param <V> data type
24  */
25 public interface SimpleCachedDao<K, V> extends SimpleDao<K, V> {
26
27     /**
28      * store given pair to local cache
29      *
30      * @param key   associated to value
31      * @param value associated to key
32      */
33     V update(@Nonnull K key, @Nullable V value);
34
35     /**
36      * invalidate all cache entries
37      */
38     void invalidateCache();
39
40     /**
41      * @return true if there is nothing cached
42      */
43     boolean isEmpty();
44
45     /**
46      * @return unmodifiable iterator through all cached values
47      */
48     Iterable<V> values();
49 }