001/* 002 * (C) Copyright 2017 Nuxeo(http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019package org.nuxeo.ecm.core.cache; 020 021import java.io.Serializable; 022 023/** 024 * Management-related APIs for a {@link Cache}. 025 * 026 * @since 9.3 027 */ 028public interface CacheManagement extends Cache { 029 030 /** 031 * Starts this cache. 032 */ 033 void start(); 034 035 /** 036 * Stops this cache and releases related resources. 037 */ 038 void stop(); 039 040 /** 041 * Returns this cache size (approximate number of entries), or {@code -1} if the number of entries is unknown or too 042 * expensive to compute. 043 * 044 * @return the approximate number of entries, or {@code -1} 045 * @since 9.1 046 */ 047 long getSize(); 048 049 /** 050 * Stores a {@link Serializable} value into the cache locally. Does not propagate invalidations. 051 * 052 * @param key the key 053 * @param value the value 054 * @since 9.3 055 */ 056 void putLocal(String key, Serializable value); 057 058 /** 059 * Invalidates the given key locally. Does not propagate invalidations. 060 * 061 * @param key the key to remove from the cache 062 * @since 9.3 063 */ 064 void invalidateLocal(String key); 065 066 /** 067 * Invalidates all keys locally. Does not propagate invalidations. 068 * 069 * @since 9.3 070 */ 071 void invalidateLocalAll(); 072 073}