Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
CacheMacroParameters | 30 | 6 | 0% | 6 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.rendering.macro.cache; | |
21 | ||
22 | import org.xwiki.properties.annotation.PropertyDescription; | |
23 | ||
24 | /** | |
25 | * Parameters for the Cache macro. | |
26 | * | |
27 | * @version $Id: c251db8614066d9ccd81643b9a1b4413303f32b2 $ | |
28 | * @since 3.0M1 | |
29 | */ | |
30 | public class CacheMacroParameters | |
31 | { | |
32 | /** | |
33 | * @see #getId() | |
34 | */ | |
35 | private String id; | |
36 | ||
37 | /** | |
38 | * @see #getTimeToLive() | |
39 | */ | |
40 | private int lifespan = 300; | |
41 | ||
42 | /** | |
43 | * @see #getMaxEntries() | |
44 | */ | |
45 | private int maxEntries = 1000; | |
46 | ||
47 | /** | |
48 | * @return the optional unique id to use to cache the content. If not defined then use the content itself as the id | |
49 | * but this doesn't guarantee unicity since the same content could be located on several pages with | |
50 | * different results. Also note that the id is considered containing wiki syntax; this is done so that the | |
51 | * user can use script macros to generate the id | |
52 | */ | |
53 | 14 | public String getId() |
54 | { | |
55 | 14 | return this.id; |
56 | } | |
57 | ||
58 | /** | |
59 | * @param id refer to {@link #getId()} | |
60 | */ | |
61 | 3 | @PropertyDescription("a unique id under which the content is cached") |
62 | public void setId(String id) | |
63 | { | |
64 | 3 | this.id = id; |
65 | } | |
66 | ||
67 | /** | |
68 | * @return the number of seconds to cache the content | |
69 | */ | |
70 | 10 | public int getTimeToLive() |
71 | { | |
72 | 10 | return this.lifespan; |
73 | } | |
74 | ||
75 | /** | |
76 | * @param lifespan refer to {@link #getTimeToLive()} | |
77 | */ | |
78 | 3 | @PropertyDescription("the number of seconds to cache the content") |
79 | public void setTimeToLive(int lifespan) | |
80 | { | |
81 | 3 | this.lifespan = lifespan; |
82 | } | |
83 | ||
84 | /** | |
85 | * @return the maximum number of entries in the cache (Least Recently Used entries are ejected) | |
86 | */ | |
87 | 10 | public int getMaxEntries() |
88 | { | |
89 | 10 | return this.maxEntries; |
90 | } | |
91 | ||
92 | /** | |
93 | * @param maxEntries refer to {@link #getMaxEntries()} | |
94 | */ | |
95 | 3 | @PropertyDescription("the maximum number of entries in the cache (Least Recently Used entries are ejected)") |
96 | public void setMaxEntries(int maxEntries) | |
97 | { | |
98 | 3 | this.maxEntries = maxEntries; |
99 | } | |
100 | } |