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
020import java.io.IOException;
021
022/**
023 * Abstract class to be extended to provide new cache implementation
024 *
025 * @since 6.0
026 */
027public abstract class AbstractCache implements Cache {
028
029    protected final String name;
030
031    protected final int ttl;
032
033    protected AbstractCache(CacheDescriptor desc) {
034        name = desc.name;
035        ttl = desc.ttl;
036    }
037
038    @Override
039    public String getName() {
040        return name;
041    }
042
043    @Override
044    public boolean hasEntry(String key) {
045        // dummy implementation to avoid breaking compatibility
046        return get(key) != null;
047    }
048
049}