001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.cache; 020 021import java.io.IOException; 022 023import lucee.commons.io.cache.Cache; 024import lucee.runtime.config.Config; 025import lucee.runtime.config.ConfigServerImpl; 026import lucee.runtime.type.Struct; 027 028public class ServerCacheConnection implements CacheConnection { 029 030 private CacheConnection cc; 031 private ConfigServerImpl cs; 032 033 /** 034 * Constructor of the class 035 * @param configServer 036 * @param cc 037 */ 038 public ServerCacheConnection(ConfigServerImpl cs, CacheConnection cc) { 039 this.cs=cs; 040 this.cc=cc; 041 } 042 043 @Override 044 public CacheConnection duplicate(Config config) throws IOException { 045 return new ServerCacheConnection(cs,cc.duplicate(config)); 046 } 047 048 @Override 049 public Class getClazz() { 050 return cc.getClazz(); 051 } 052 053 @Override 054 public Struct getCustom() { 055 return cc.getCustom(); 056 } 057 058 @Override 059 public Cache getInstance(Config config) throws IOException { 060 return cc.getInstance(cs); 061 } 062 063 public String getName() { 064 return cc.getName(); 065 } 066 067 @Override 068 public boolean isReadOnly() { 069 return true; 070 } 071 072 @Override 073 public boolean isStorage() { 074 return cc.isStorage(); 075 } 076 077}