3 //=============================================================================
5 * @file Caching_Utility_T.h
7 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
9 //=============================================================================
11 #ifndef ACE_CACHING_UTILITY_H
12 #define ACE_CACHING_UTILITY_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Global_Macros.h"
23 #include "ace/Cleanup_Strategies_T.h"
24 #include "ace/Copy_Disabled.h"
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 * @class ACE_Pair_Caching_Utility
31 * @brief Defines a helper class for the Caching Strategies.
33 * This class defines the methods commonly used by the different
34 * caching strategies. For instance: clear_cache() method which
35 * decides and purges the entry from the container. @note This
36 * class helps in the caching_strategies using a container
37 * containing entries of <KEY, ACE_Pair<VALUE, attributes>>
38 * kind. The attributes helps in deciding the entries to be
39 * purged. The Cleanup_Strategy is the callback class to which the
40 * entries to be cleaned up will be delegated.
42 template <class KEY
, class VALUE
, class CONTAINER
, class ITERATOR
, class ATTRIBUTES
>
43 class ACE_Pair_Caching_Utility
: private ACE_Copy_Disabled
46 typedef ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY
;
49 ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> *cleanup_strategy
= 0,
50 bool delete_cleanup_strategy
= false);
53 ~ACE_Pair_Caching_Utility ();
56 * Purge entries from the @a container. The Cleanup_Strategy will do the
57 * actual job of cleanup once the entries to be cleaned up are decided.
59 int clear_cache (CONTAINER
&container
, double purge_percent
);
62 /// Find the entry with minimum caching attributes.
63 void minimum (CONTAINER
&container
,
65 VALUE
*&value_to_remove
);
67 /// The cleanup strategy which can be used to destroy the entries of
69 CLEANUP_STRATEGY
*cleanup_strategy_
;
71 /// Whether the cleanup_strategy should be destroyed or not.
72 bool delete_cleanup_strategy_
;
76 * @class ACE_Recyclable_Handler_Caching_Utility
78 * @brief Defines a helper class for the Caching Strategies.
80 * This class defines the methods commonly used by the different
81 * caching strategies. For instance: clear_cache() method which
82 * decides and purges the entry from the container. @note This
83 * class helps in the caching_strategies using a container
84 * containing entries of <KEY, Svc_Handler> kind. The attributes
85 * helps in deciding the entries to be purged. The
86 * Cleanup_Strategy is the callback class to which the entries to
87 * be cleaned up will be delegated.
89 template <class KEY
, class VALUE
, class CONTAINER
, class ITERATOR
, class ATTRIBUTES
>
90 class ACE_Recyclable_Handler_Caching_Utility
: private ACE_Copy_Disabled
93 typedef ACE_Recyclable_Handler_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY
;
94 typedef ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY_BASE
;
97 ACE_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> *cleanup_strategy
= 0,
98 bool delete_cleanup_strategy
= false);
101 ~ACE_Recyclable_Handler_Caching_Utility ();
104 * Purge entries from the @a container. The Cleanup_Strategy will do
105 * the actual job of cleanup once the entries to be cleaned up are
108 int clear_cache (CONTAINER
&container
,
109 double purge_percent
);
112 /// Find the entry with minimum caching attributes.
113 void minimum (CONTAINER
&container
,
115 VALUE
*&value_to_remove
);
117 /// This is the default Cleanup Strategy for this utility.
118 CLEANUP_STRATEGY_BASE
*cleanup_strategy_
;
120 /// Whether the cleanup_strategy should be destroyed or not.
121 bool delete_cleanup_strategy_
;
125 * @class ACE_Refcounted_Recyclable_Handler_Caching_Utility
127 * @brief Defines a helper class for the Caching Strategies.
129 * This class defines the methods commonly used by the different
130 * caching strategies. For instance: clear_cache () method which
131 * decides and purges the entry from the container. @note This
132 * class helps in the caching_strategies using a container
133 * containing entries of <Refcounted_KEY,
134 * Recyclable_Connection_Handler> kind. The attributes helps in
135 * deciding the entries to be purged. The Cleanup_Strategy is the
136 * callback class to which the entries to be cleaned up will be
139 template <class KEY
, class VALUE
, class CONTAINER
, class ITERATOR
, class ATTRIBUTES
>
140 class ACE_Refcounted_Recyclable_Handler_Caching_Utility
: private ACE_Copy_Disabled
143 typedef ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY
;
144 typedef ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY_BASE
;
147 ACE_Refcounted_Recyclable_Handler_Caching_Utility (ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> *cleanup_strategy
= 0,
148 bool delete_cleanup_strategy
= false);
151 ~ACE_Refcounted_Recyclable_Handler_Caching_Utility ();
154 * Purge entries from the @a container. The Cleanup_Strategy will do
155 * the actual job of cleanup once the entries to be cleaned up are
158 int clear_cache (CONTAINER
&container
,
159 double purge_percent
);
162 /// Find the entry with minimum caching attributes.
163 void minimum (CONTAINER
&container
,
165 VALUE
*&value_to_remove
);
167 /// This is the default Cleanup Strategy for this utility.
168 CLEANUP_STRATEGY_BASE
*cleanup_strategy_
;
170 /// Whether the cleanup_strategy should be destroyed or not.
171 bool delete_cleanup_strategy_
;
174 * This figure denotes the number of entries are there in the
175 * container which have been marked as closed already but might
176 * not have been unbound from the container.
178 size_t marked_as_closed_entries_
;
182 * @class ACE_Handler_Caching_Utility
184 * @brief Defines a helper class for the Caching Strategies.
186 * This class defines the methods commonly used by the different
187 * caching strategies. For instance: clear_cache() method which
188 * decides and purges the entry from the container. @note This
189 * class helps in the caching_strategies using a container
190 * containing entries of <KEY, HANDLER> kind where the HANDLER
191 * contains the caching attributes which help in deciding the
192 * entries to be purged. The Cleanup_Strategy is the callback
193 * class to which the entries to be cleaned up will be delegated.
195 template <class KEY
, class VALUE
, class CONTAINER
, class ITERATOR
, class ATTRIBUTES
>
196 class ACE_Handler_Caching_Utility
: private ACE_Copy_Disabled
199 typedef ACE_Handler_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY
;
200 typedef ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY_BASE
;
203 ACE_Handler_Caching_Utility (ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> *cleanup_strategy
= 0,
204 bool delete_cleanup_strategy
= false);
207 ~ACE_Handler_Caching_Utility ();
210 * Purge entries from the @a container. The Cleanup_Strategy will do
211 * the actual job of cleanup once the entries to be cleaned up are
214 int clear_cache (CONTAINER
&container
,
215 double purge_percent
);
219 * Find the entry with minimum caching attributes. This is handler
220 * specific since this utility is to be used very specifically for
221 * handler who have caching_attributes for server side acched
222 * connection management.
224 void minimum (CONTAINER
&container
,
226 VALUE
*&value_to_remove
);
228 /// The cleanup strategy which can be used to destroy the entries of
230 CLEANUP_STRATEGY_BASE
*cleanup_strategy_
;
232 /// Whether the cleanup_strategy should be destroyed or not.
233 bool delete_cleanup_strategy_
;
237 * @class ACE_Null_Caching_Utility
239 * @brief Defines a dummy helper class for the Caching Strategies.
241 * This class defines the methods commonly used by the different
242 * caching strategies. For instance: clear_cache() method which
243 * decides and purges the entry from the container. @note This
244 * class is be used with the Null_Caching_Strategy. The
245 * Cleanup_Strategy is the callback class to which the entries to
246 * be cleaned up will be delegated.
248 template <class KEY
, class VALUE
, class CONTAINER
, class ITERATOR
, class ATTRIBUTES
>
249 class ACE_Null_Caching_Utility
: private ACE_Copy_Disabled
252 typedef ACE_Null_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY
;
253 typedef ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> CLEANUP_STRATEGY_BASE
;
256 ACE_Null_Caching_Utility (ACE_Cleanup_Strategy
<KEY
, VALUE
, CONTAINER
> *cleanup_strategy
= 0,
257 bool delete_cleanup_strategy
= false);
260 ~ACE_Null_Caching_Utility ();
263 * Purge entries from the @a container. The Cleanup_Strategy will do
264 * the actual job of cleanup once the entries to be cleaned up are
265 * decided. @note Here it is a no-op.
267 int clear_cache (CONTAINER
&container
,
268 double purge_percent
);
272 * Find the entry with minimum caching attributes. This is handler
273 * specific since this utility is to be used very specifically for
274 * handler who have caching_attributes for server side acched
275 * connection management.@note Here it is a no-op.
277 void minimum (CONTAINER
&container
,
279 VALUE
*&value_to_remove
);
281 /// The cleanup strategy which can be used to destroy the entries of
283 CLEANUP_STRATEGY_BASE
*cleanup_strategy_
;
285 /// Whether the cleanup_strategy should be destroyed or not.
286 bool delete_cleanup_strategy_
;
289 ACE_END_VERSIONED_NAMESPACE_DECL
291 #include "ace/Caching_Utility_T.cpp"
293 #include /**/ "ace/post.h"
295 #endif /* ACE_CACHING_UTILITY_H */