01: /*
02: * Copyright 2002 Sun Microsystems, Inc. All
03: * rights reserved. Use of this product is subject
04: * to license terms. Federal Acquisitions:
05: * Commercial Software -- Government Users
06: * Subject to Standard License Terms and
07: * Conditions.
08: *
09: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
10: * are trademarks or registered trademarks of Sun Microsystems,
11: * Inc. in the United States and other countries.
12: */
13:
14: package com.sun.portal.container.portlet;
15:
16: /**
17: * This class represents an entry in the portlet content cache
18: */
19:
20: public class PortletCacheEntry {
21:
22: private int _type;
23: private StringBuffer _content;
24: private String _titleResource;
25: private long _expirationTime;
26:
27: /**
28: * Constructor for a class representing an entry in the
29: * portlet content cache.
30: * <p>
31: * @param cacheType either <code>PortletCacheType.TYPE_EXPIRATION
32: * </code> or <code>PortletCacheType.TYPE_VALIDATING</code>
33: * @param content portlet content represented in the <code>
34: * StringBuffer</code> format
35: * @param titleResource portlet title resource represented in the <code>
36: * String</code> format
37: * @param expiration duration (in seconds) of the expiration
38: * cache, only used in the case of EXPIRATION cache
39: */
40: public PortletCacheEntry(int cacheType, StringBuffer cachedContent,
41: String titleResource, int expiration) {
42:
43: _type = cacheType;
44: _content = cachedContent;
45: _titleResource = titleResource;
46: if (expiration == -1) { // cache never expires
47: _expirationTime = Long.MAX_VALUE;
48: } else {
49: _expirationTime = System.currentTimeMillis() + expiration
50: * 1000;
51: }
52:
53: }
54:
55: public int getCacheType() {
56: return _type;
57: }
58:
59: public StringBuffer getCachedContent() {
60: return _content;
61: }
62:
63: public String getTitleResource() {
64: return _titleResource;
65: }
66:
67: public long getExpirationTime() {
68: return _expirationTime;
69: }
70: }
|