001/*******************************************************************************
002The MIT License (MIT)
003
004Copyright (c) 2024 KILLCODING.COM
005
006Permission is hereby granted, free of charge, to any person obtaining a copy
007of this software and associated documentation files (the "Software"), to deal
008in the Software without restriction, including without limitation the rights
009to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
010copies of the Software, and to permit persons to whom the Software is
011furnished to do so, subject to the following conditions:
012
013The above copyright notice and this permission notice shall be included in
014all copies or substantial portions of the Software.
015
016THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
017IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
018FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
019AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
020LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
021OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
022THE SOFTWARE.
023*****************************************************************************/
024package com.killcoding.cache;
025
026import java.util.List;
027
028/**
029 * This abstract class, it is the framework base cache class.
030 **/
031public abstract class AbsCacheApi {
032    
033    protected static Long TIMER = 100L;
034    
035    /**
036     * Force write cache
037     * */
038    protected Boolean stored = false;    
039
040    /**
041     * New an AbsCacheApi
042     * Need 'override' abstract method
043     * 'stored' is use default value (default is false)
044     * */
045        public AbsCacheApi() {
046                super();
047        }
048        
049        /**
050         * New an AbsCacheApi
051         * Need 'override' abstract method
052         * @param stored - true is force write
053         * */
054        public AbsCacheApi(Boolean stored) {
055                super();
056                this.stored = stored;
057        }       
058        
059        abstract void set(String name,Object value,int live);
060        abstract Object get(String name);
061        abstract List<String> getNames();
062        abstract boolean included(String name);
063        abstract void remove(String name);
064        abstract void removeAll();
065
066}