001/* 002 * (C) Copyright 2017 Nuxeo SA (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 */ 017package org.nuxeo.ecm.core.cache; 018 019import java.io.Serializable; 020import java.util.Set; 021 022/** 023 * @since 9.1 024 */ 025public class CacheWrapper implements CacheManagement { 026 027 public final CacheManagement cache; 028 029 protected CacheWrapper(CacheManagement cache) { 030 this.cache = cache; 031 } 032 033 @Override 034 public String getName() { 035 return cache.getName(); 036 } 037 038 @Override 039 public Serializable get(String key) { 040 return cache.get(key); 041 } 042 043 @Override 044 public Set<String> keySet() { 045 return cache.keySet(); 046 } 047 048 @Override 049 public void invalidateLocal(String key) { 050 cache.invalidateLocal(key); 051 } 052 053 @Override 054 public void invalidate(String key) { 055 cache.invalidate(key); 056 } 057 058 @Override 059 public void invalidateLocalAll() { 060 cache.invalidateLocalAll(); 061 } 062 063 @Override 064 public void invalidateAll() { 065 cache.invalidateAll(); 066 } 067 068 @Override 069 public void putLocal(String key, Serializable value) { 070 cache.putLocal(key, value); 071 } 072 073 @Override 074 public void put(String key, Serializable value) { 075 cache.put(key, value); 076 } 077 078 @Override 079 public boolean hasEntry(String key) { 080 return cache.hasEntry(key); 081 } 082 083 @Override 084 public void start() { 085 cache.start(); 086 } 087 088 @Override 089 public void stop() { 090 cache.stop(); 091 } 092 093 @Override 094 public long getSize() { 095 return cache.getSize(); 096 } 097 098 @Override 099 public String toString() { 100 return getClass().getSimpleName() + "(" + cache + ")"; 101 } 102 103}