X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=sxp-integration%2Fsxp-ep-provider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fgroupbasedpolicy%2Fsxp%2Fep%2Fprovider%2Fimpl%2FSimpleCachedDao.java;fp=sxp-integration%2Fsxp-ep-provider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fgroupbasedpolicy%2Fsxp%2Fep%2Fprovider%2Fimpl%2FSimpleCachedDao.java;h=913274bd367d3b0ca79c4a1875f02514fc68517d;hb=eace708ec9dd394c5eb7b74c46d1176d82e775e7;hp=0000000000000000000000000000000000000000;hpb=660f6fb82d48f2c43b92cd273593d49e3644bb41;p=groupbasedpolicy.git diff --git a/sxp-integration/sxp-ep-provider/src/main/java/org/opendaylight/groupbasedpolicy/sxp/ep/provider/impl/SimpleCachedDao.java b/sxp-integration/sxp-ep-provider/src/main/java/org/opendaylight/groupbasedpolicy/sxp/ep/provider/impl/SimpleCachedDao.java new file mode 100644 index 000000000..913274bd3 --- /dev/null +++ b/sxp-integration/sxp-ep-provider/src/main/java/org/opendaylight/groupbasedpolicy/sxp/ep/provider/impl/SimpleCachedDao.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.groupbasedpolicy.sxp.ep.provider.impl; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * Purpose: encapsulate access to DS by exposing + *
+ *
find
+ *
search through cached values
+ *
update
+ *
stores given pair (key, value) to local cache
+ *
+ * + * @param data key type + * @param data type + */ +public interface SimpleCachedDao extends SimpleDao { + + /** + * store given pair to local cache + * + * @param key associated to value + * @param value associated to key + */ + V update(@Nonnull K key, @Nullable V value); + + /** + * invalidate all cache entries + */ + void invalidateCache(); + + /** + * @return true if there is nothing cached + */ + boolean isEmpty(); + + /** + * @return unmodifiable iterator through all cached values + */ + Iterable values(); +}