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.type.scope.storage;
020
021import lucee.runtime.config.Config;
022import lucee.runtime.type.scope.SharedScope;
023
024
025/**
026 * scope that can be stored, in a storage
027 */
028public interface StorageScope extends SharedScope {
029        /*
030        public static Collection.Key CFID=Util.toKey("cfid");
031        public static Collection.Key CFTOKEN=Util.toKey("cftoken");
032        public static Collection.Key URLTOKEN=Util.toKey("urltoken");
033        public static Collection.Key LASTVISIT=Util.toKey("lastvisit");
034        public static Collection.Key HITCOUNT=Util.toKey("hitcount");
035        public static Collection.Key TIMECREATED=Util.toKey("timecreated");
036        public static Collection.Key SESSION_ID=Util.toKey("sessionid");
037        */
038        /**
039         * @return time when the Scope last time was visited
040         */
041        public abstract long lastVisit();
042        
043        public abstract String getStorageType();
044        
045        public long getLastAccess();
046        
047        public void touch();
048        
049        public boolean isExpired();
050        
051        public long getTimeSpan();
052
053        /**
054         * store content on persistent layer
055         */
056        public void store(Config config);
057        
058        /**
059         * remove stored data from persistent layer
060         */
061        public void unstore(Config config);
062        
063
064        /**
065         * sets the name of the storage used, this is not the storage type!
066         * @param storage
067         */
068        public void setStorage(String storage);
069        /**
070         * return the name of the storage used, this is not the storage type!
071         * @return
072         */
073        public String getStorage();
074        
075
076        /**
077         * Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.
078         * @param interval - An integer specifying the number of seconds
079         */
080        public void setMaxInactiveInterval(int interval);
081        
082        /**
083         * Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never timeout.
084         * @return an integer specifying the number of seconds this session remains open between client requests
085         */
086        public int getMaxInactiveInterval();
087        
088
089        
090        public long getCreated();
091        
092        public String generateToken(String key, boolean forceNew);
093        
094        public boolean verifyToken(String token, String key);
095}