org.opencms.flex.CmsFlexCacheEntry Maven / Gradle / Ivy
Show all versions of opencms-core Show documentation
/*
* This library is part of OpenCms -
* the Open Source Content Management System
*
* Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* For further information about Alkacon Software GmbH & Co. KG, please see the
* company website: http://www.alkacon.com
*
* For further information about OpenCms, please see the
* project website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.opencms.flex;
import org.opencms.cache.I_CmsLruCacheObject;
import org.opencms.file.CmsResource;
import org.opencms.flex.CmsFlexBucketConfiguration.BucketSet;
import org.opencms.i18n.CmsMessageContainer;
import org.opencms.jsp.util.CmsJspStandardContextBean;
import org.opencms.main.CmsLog;
import org.opencms.monitor.CmsMemoryMonitor;
import org.opencms.monitor.I_CmsMemoryMonitorable;
import org.opencms.util.CmsCollectionsGenericWrapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.ServletException;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.logging.Log;
/**
* Contains the contents of a cached resource.
*
* It is basically a list of pre-generated output,
* include() calls to other resources (with request parameters) and http headers that this
* resource requires to be set.
*
* A CmsFlexCacheEntry might also describe a redirect-call, but in this case
* nothing else will be cached.
*
* The pre-generated output is saved in byte[]
arrays.
* The include() calls are saved as Strings of the included resource name,
* the parameters for the calls are saved in a HashMap.
* The headers are saved in a HashMap.
* In case of a redirect, the redirect target is cached in a String.
*
* The CmsFlexCacheEntry can also have an expire date value, which indicates the time
* that his entry will become invalid and should thus be cleared from the cache.
*
* @since 6.0.0
*
* @see org.opencms.cache.I_CmsLruCacheObject
*/
public class CmsFlexCacheEntry implements I_CmsLruCacheObject, I_CmsMemoryMonitorable {
/** Initial size for lists. */
public static final int INITIAL_CAPACITY_LISTS = 10;
/** The log object for this class. */
private static final Log LOG = CmsLog.getLog(CmsFlexCacheEntry.class);
/** the assigned bucket set for this flex entry (may be null). */
private BucketSet m_bucketSet;
/** The CacheEntry's size in bytes. */
private int m_byteSize;
/** Indicates if this cache entry is completed. */
private boolean m_completed;
/** The "expires" date for this Flex cache entry. */
private long m_dateExpires;
/** The "last modified" date for this Flex cache entry. */
private long m_dateLastModified;
/** The list of items for this resource. */
private List