001/* 002 * (C) Copyright 2014 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Maxime Hilaire 016 * 017 */ 018package org.nuxeo.ecm.core.cache; 019 020 021/** 022 * Abstract class to be extended to provide new cache implementation 023 * 024 * @since 6.0 025 */ 026public abstract class AbstractCache implements Cache { 027 028 protected final String name; 029 030 protected final int ttl; 031 032 protected AbstractCache(CacheDescriptor desc) { 033 name = desc.name; 034 ttl = desc.ttl; 035 } 036 037 @Override 038 public String getName() { 039 return name; 040 } 041 042 @Override 043 public boolean hasEntry(String key) { 044 // dummy implementation to avoid breaking compatibility 045 return get(key) != null; 046 } 047 048}