diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-03 22:21:52 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-03 22:21:52 +0000 |
commit | 77d79764407c2cc52911c4153d668e58b510cf7c (patch) | |
tree | c81624e73a9bc0d248b3f2ed6876a79029260aba | |
parent | 69ca6283c81f2fb1a9cfb133b57a19f34676bcef (diff) | |
download | ATCD-77d79764407c2cc52911c4153d668e58b510cf7c.tar.gz |
caching strategies
-rw-r--r-- | ace/Caching_Strategies_T.cpp | 261 | ||||
-rw-r--r-- | ace/Caching_Strategies_T.h | 434 | ||||
-rw-r--r-- | ace/Caching_Strategies_T.i | 295 |
3 files changed, 990 insertions, 0 deletions
diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp new file mode 100644 index 00000000000..ad5821b81d0 --- /dev/null +++ b/ace/Caching_Strategies_T.cpp @@ -0,0 +1,261 @@ +//$Id$ + +#ifndef CACHING_STRATEGIES_T_C +#define CACHING_STRATEGIES_T_C + +#include "ace/Caching_Strategies_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Caching_Strategies_T.i" +#endif /* __ACE_INLINE__ */ + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#define ACE_LACKS_PRAGMA_ONCE +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_RCSID(ace, Caching_Strategies_T, "$Id$") + +template<class CONTAINER> +ACE_LRU_Caching_Strategy<CONTAINER>::ACE_LRU_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) + : timer_ (0), + purge_percent_ (10), + entries_ (0), + cleanup_strategy_ (0), + delete_cleanup_strategy_ (1) +{ + if (this->open (cleanup_s, delete_cleanup_strategy) == -1) + ACE_ERROR ((LM_ERROR, + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("ACE_LRU_Caching_Strategy::ACE_LRU_Caching_Strategy"))); + +} + +template<class CONTAINER> +ACE_LRU_Caching_Strategy<CONTAINER>::~ACE_LRU_Caching_Strategy (void) +{ +} + +template<class CONTAINER> int +ACE_LRU_Caching_Strategy<CONTAINER>::open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) +{ + // Initialise the cleanup strategy. + + // First we decide whether we need to clean up. + if (this->cleanup_strategy_ != 0 && + this->delete_cleanup_strategy_ == 1 && + cleanup_s != 0) + + { + + delete this->cleanup_strategy_; + + this->cleanup_strategy_ = 0; + + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + + } + + if (cleanup_s != 0) + this->cleanup_strategy_ = cleanup_s; + else if (this->cleanup_strategy_ == 0) + { + + ACE_NEW_RETURN (this->cleanup_strategy_, + CLEANUP_STRATEGY, + -1); + + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + + } + + return 0; +} + +template<class CONTAINER> int +ACE_LRU_Caching_Strategy<CONTAINER>::clear_cache (CONTAINER &container) +{ + return this->caching_strategy_utility_.clear_cache (container, + this->cleanup_strategy_, + this->purge_percent_, + this->entries_); +} + +//////////////////////////////////////////////////////////////////////////////////////////////// + +template<class CONTAINER> +ACE_LFU_Caching_Strategy<CONTAINER>::ACE_LFU_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) + : purge_percent_ (10), + entries_ (0), + cleanup_strategy_ (0), + delete_cleanup_strategy_ (1) +{ + if (this->open (cleanup_s, delete_cleanup_strategy) == -1) + ACE_ERROR ((LM_ERROR, + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("ACE_LFU_Caching_Strategy::ACE_LFU_Caching_Strategy"))); + +} + +template<class CONTAINER> +ACE_LFU_Caching_Strategy<CONTAINER>::~ACE_LFU_Caching_Strategy (void) +{ +} + +template<class CONTAINER> int +ACE_LFU_Caching_Strategy<CONTAINER>::open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) +{ + // Initialise the cleanup strategy. + + // First we decide whether we need to clean up. + if (this->cleanup_strategy_ != 0 && + this->delete_cleanup_strategy_ == 1 && + cleanup_s != 0) + { + + delete this->cleanup_strategy_; + + this->cleanup_strategy_ = 0; + + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + + } + + if (cleanup_s != 0) + this->cleanup_strategy_ = cleanup_s; + else if (this->cleanup_strategy_ == 0) + { + + ACE_NEW_RETURN (this->cleanup_strategy_, + CLEANUP_STRATEGY, + -1); + + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + + } + + return 0; +} + +template<class CONTAINER> int +ACE_LFU_Caching_Strategy<CONTAINER>::clear_cache (CONTAINER &container) +{ + + return this->caching_strategy_utility_.clear_cache (container, + this->cleanup_strategy_, + this->purge_percent_, + this->entries_); +} + +//////////////////////////////////////////////////////////////////////////////////////////////// + +template<class CONTAINER> +ACE_FIFO_Caching_Strategy<CONTAINER>::ACE_FIFO_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) + : order_ (0), + purge_percent_ (10), + entries_ (0), + cleanup_strategy_ (0), + delete_cleanup_strategy_ (1) +{ + if (this->open (cleanup_s, delete_cleanup_strategy) == -1) + ACE_ERROR ((LM_ERROR, + ASYS_TEXT ("%p\n"), + ASYS_TEXT ("ACE_FIFO_Caching_Strategy::ACE_FIFO_Caching_Strategy"))); +} + +template<class CONTAINER> +ACE_FIFO_Caching_Strategy<CONTAINER>::~ACE_FIFO_Caching_Strategy (void) + +{ +} + +template<class CONTAINER> int +ACE_FIFO_Caching_Strategy<CONTAINER>::open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) +{ + // Initialise the cleanup strategy. + + // First we decide whether we need to clean up. + if (this->cleanup_strategy_ != 0 && + this->delete_cleanup_strategy_ == 1 && + cleanup_s != 0) + { + + delete this->cleanup_strategy_; + + this->cleanup_strategy_ = 0; + + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + + } + + if (cleanup_s != 0) + this->cleanup_strategy_ = cleanup_s; + else if (this->cleanup_strategy_ == 0) + { + + ACE_NEW_RETURN (this->cleanup_strategy_, + CLEANUP_STRATEGY, + -1); + + this->delete_cleanup_strategy_ = delete_cleanup_strategy; + + } + + return 0; +} + + + + +template<class CONTAINER> int +ACE_FIFO_Caching_Strategy<CONTAINER>::clear_cache (CONTAINER &container) +{ + + return this->caching_strategy_utility_.clear_cache (container, + this->cleanup_strategy_, + this->purge_percent_, + this->entries_); +} + + +//////////////////////////////////////////////////////////////////////////////////////////////// + + +template<class CONTAINER> +ACE_Null_Caching_Strategy<CONTAINER>::ACE_Null_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) +{ +} + +template<class CONTAINER> int +ACE_Null_Caching_Strategy<CONTAINER>::open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s, + int delete_cleanup_strategy) +{ +} + +template<class CONTAINER> +ACE_Null_Caching_Strategy<CONTAINER>::~ACE_Null_Caching_Strategy (void) +{ +} + +template<class CONTAINER> int +ACE_Null_Caching_Strategy<CONTAINER>::clear_cache (CONTAINER &container) +{ + return 0; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +ACE_ALLOC_HOOK_DEFINE(ACE_LRU_Caching_Strategy) +ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy) +ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy) +ACE_ALLOC_HOOK_DEFINE(ACE_Null_Caching_Strategy) +#endif /* CACHING_STRATEGIES_T_C */ + + + diff --git a/ace/Caching_Strategies_T.h b/ace/Caching_Strategies_T.h new file mode 100644 index 00000000000..686c5331d9e --- /dev/null +++ b/ace/Caching_Strategies_T.h @@ -0,0 +1,434 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Caching_Strategies_T.h +// +// = AUTHOR +// Kirthika Parameswaran <kirthika@cs.wustl.edu> +// +// ============================================================================ + +#ifndef CACHING_STRATEGIES_H +#define CACHING_STRATEGIES_H + +#include "ace/OS.h" + +#include "ace/Caching_Strategy_Utility_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#define ACE_LACKS_PRAGMA_ONCE +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Cleanup_Strategies_T.h" + +template <class CONTAINER> +class ACE_LRU_Caching_Strategy +{ + // = TITLE + // Defines a Least Recently Used strategy which will decide on + // the item to be removed from the cache. + // + // = DESCRIPTION + // This is a strategy which makes use of a virtual timer which + // is updated whenever an item is inserted or looked up in the + // container. When the need of purging entries arises, the items + // with the lowest timer values are removed. + +public: + + // Traits. + typedef int ATTRIBUTES; + typedef CONTAINER CACHE; + + // = Initialisation and termination. + + ACE_LRU_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // The <container> is the map in which the entries reside. + // The Cleanup_Strategy is the callback class to which the entries + // to be cleaned up will be delegated. The <delete_cleanup_strategy> + // flag is needed to decide the ownership of the cleanup strategy. + // Also, the timer attribute is initialed to zero in this constructor. + // And the <purge_percent> field denotes the percentage of the entries + // in the cache which can be purged automagically and by default is + // set to 10%. + + ~ACE_LRU_Caching_Strategy (void); + + // = Operations of the strategy. + + int open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // This method which does the actual initialisation. + + ATTRIBUTES attributes (void); + // Accessor method for the timer attributes. + + // = Accessor methods for the percentage of entries to purge. + int purge_percent (void); + + void purge_percent (int percentage); + + // = Strategy related Operations + + int notify_bind (int result, + const ATTRIBUTES &attr); + // This method acts as a notification about the CONTAINERs bind + // method call. + + int notify_find (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs find + // method call + + int notify_unbind (int result, + const ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs unbind + // method call + + + int notify_trybind (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs trybind + // method call + + int notify_rebind (int result, + const ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs rebind + // method call + + int clear_cache (CONTAINER &container); + // This is the method which looks at each ITEM's attributes and + // then decides on the one to remove. + + void dump (void) const; + // Dumps the state of the object. + +private: + + typedef ACE_Default_Cleanup_Strategy<CONTAINER> CLEANUP_STRATEGY; + + ATTRIBUTES timer_; + // This element is the one which is the deciding factor for purging + // of an ITEM. + + unsigned int purge_percent_; + // The level about which the purging will happen automagically. + + unsigned int entries_; + // The no of entries bound in the cache. + + ACE_Cleanup_Strategy<CONTAINER> *cleanup_strategy_; + // The cleanup strategy which can be used to destroy the entries of + // the container. + + int delete_cleanup_strategy_; + // The flag which denotes the ownership of the cleanup strategy. + // If 1 then this class itself will destroy the strategy. + + ACE_Caching_Strategy_Utility<CONTAINER, ATTRIBUTES> caching_strategy_utility_; + // This is the helper class which will decide and expunge entries + // from the cache. + +}; + +////////////////////////////////////////////////////////////////////////// + +template <class CONTAINER> +class ACE_LFU_Caching_Strategy +{ + // = TITLE + // Defines a Least Frequently Used strategy for which will decide on + // the item to be removed from the cache. + // + // = DESCRIPTION + // A attribute is tagged to each item which increments whenever + // the item is bound or looked up in the cache. Thus it denotes + // the frequency of use. According to the value of the attribute + // the item is removed from the CONTAINER i.e cache. +public: + + // Traits. + typedef int ATTRIBUTES; + + // = Initialisation and termination methods. + + ACE_LFU_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // The <container> is the map in which the entries reside. + // The Cleanup_Strategy is the callback class to which the entries + // to be cleaned up will be delegated. The <delete_cleanup_strategy> + // flag is needed to decide the ownership of the cleanup strategy. + // Also, the timer attribute is initialed to zero in this constructor. + // And the <purge_percent> field denotes the percentage of the entries + // in the cache which can be purged automagically and by default is + // set to 10%. + + ~ACE_LFU_Caching_Strategy (void); + + int open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // This method which does the actual initialisation. + + // = Strategy methods. + + ATTRIBUTES attributes (void); + // Access the attributes. + + // = Accessor methods for the percentage of entries to purge. + int purge_percent (void); + + void purge_percent (int percentage); + + // = Strategy related Operations + + int notify_bind (int result, + const ATTRIBUTES &attr); + // This method acts as a notification about the CONTAINERs bind + // method call. + + int notify_find (int result, + ATTRIBUTES &attr); + // Lookup notification. + + int notify_unbind (int result, + const ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs unbind + // method call + + int notify_trybind (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs trybind + // method call + + int notify_rebind (int result, + const ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs rebind + // method call + + + int clear_cache (CONTAINER &container); + // This is the method which looks at each ITEM's attributes and + // then decides on the one to remove. + + void dump (void) const; + // Dumps the state of the object. + +private: + + typedef ACE_Default_Cleanup_Strategy<CONTAINER> CLEANUP_STRATEGY; + + unsigned int purge_percent_; + // The level about which the purging will happen automagically. + + unsigned int entries_; + // The no of entries bound in the cache. + + ACE_Cleanup_Strategy<CONTAINER> *cleanup_strategy_; + // The cleanup strategy which can be used to destroy the entries of + // the container. + + int delete_cleanup_strategy_; + // The flag which denotes the ownership of the cleanup strategy. + // If 1 then this class itself will destroy the strategy. + + ACE_Caching_Strategy_Utility<CONTAINER, ATTRIBUTES> caching_strategy_utility_; + // This is the helper class which will decide and expunge entries + // from the cache. + +}; + +///////////////////////////////////////////////////////////// + +template<class CONTAINER> +class ACE_FIFO_Caching_Strategy +{ + // = TITLE + // The First In First Out strategy is implemented wherein each + // item is ordered. + // + // = DESCRIPTION + // The order tag of each item is used to decide the item to be + // removed from the cache. The items with least order are removed. +public: + + typedef int ATTRIBUTES; + + // = Initialisation and termination. + + ACE_FIFO_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // The <container> is the map in which the entries reside. + // The Cleanup_Strategy is the callback class to which the entries + // to be cleaned up will be delegated. The <delete_cleanup_strategy> + // flag is needed to decide the ownership of the cleanup strategy. + // Also, the timer attribute is initialed to zero in this constructor. + // And the <purge_percent> field denotes the percentage of the entries + // in the cache which can be purged automagically and by default is + // set to 10%. + + ~ACE_FIFO_Caching_Strategy (void); + + int open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // This method which does the actual initialisation. + + // = Strategy methods. + + ATTRIBUTES attributes (void); + // Accessor method. + + // = Accessor methods for the percentage of entries to purge. + int purge_percent (void); + + void purge_percent (int percentage); + + // = Strategy related Operations + + int notify_bind (int result, + const ATTRIBUTES &attr); + // Notification for an item getting bound into the cache. + + int notify_find (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs find + // method call + + int notify_unbind (int result, + const ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs unbind + // method call + + int notify_trybind (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs trybind + // method call + + int notify_rebind (int result, + const ATTRIBUTES &attr); + // Notification for an item getting bound again into the cache. + + int clear_cache (CONTAINER &container); + // This is the method which looks at each ITEM's attributes and + // then decides on the one to remove. + + void dump (void) const; + // Dumps the state of the object. + +private: + + typedef ACE_Default_Cleanup_Strategy<CONTAINER> CLEANUP_STRATEGY; + + ATTRIBUTES order_; + // The order is the deciding factor for the item to be removed from + // the cache. + + unsigned int purge_percent_; + // The level about which the purging will happen automagically. + + unsigned int entries_; + // The no of entries bound in the cache. + + ACE_Cleanup_Strategy<CONTAINER> *cleanup_strategy_; + // The cleanup strategy which can be used to destroy the entries of + // the container. + + int delete_cleanup_strategy_; + // The flag which denotes the ownership of the cleanup strategy. + // If 1 then this class itself will destroy the strategy. + + ACE_Caching_Strategy_Utility<CONTAINER, ATTRIBUTES> caching_strategy_utility_; + // This is the helper class which will decide and expunge entries + // from the cache. +}; + +template<class CONTAINER> +class ACE_Null_Caching_Strategy +{ + // = TITLE + // The is a special caching strategy which doesnt have the purging + // feature. + // + // = DESCRIPTION + // No purging provided. To be used when purging might be too expensive + // an operation. + +public: + + typedef int ATTRIBUTES; + + // = Initialisation and termination. + + ACE_Null_Caching_Strategy (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + + ~ACE_Null_Caching_Strategy (void); + + + int open (ACE_Cleanup_Strategy<CONTAINER> *cleanup_s = 0, + int delete_cleanup_strategy = 1); + // This method which does the actual initialisation. + + // = Strategy methods. All are NO_OP methods!!! + + ATTRIBUTES attributes (void); + // Accessor method. + + // = Accessor methods for the percentage of entries to purge. + int purge_percent (void); + + void purge_percent (int percentage); + + // = Strategy related Operations + + int notify_bind (int result, + const ATTRIBUTES &attr); + // Notification for an item getting bound into the cache. + + int notify_find (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs find + // method call + + int notify_unbind (int result, + const ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs unbind + // method call + + int notify_trybind (int result, + ATTRIBUTES &attr); + //This method acts as a notification about the CONTAINERs trybind + // method call + + int notify_rebind (int result, + const ATTRIBUTES &attr); + // Notification for an item getting bound again into the cache. + + int clear_cache (CONTAINER &container); + // This is the method which looks at each ITEM's attributes and + // then decides on the one to remove. + + void dump (void) const; + // Dumps the state of the object. + +}; + +#if defined (__ACE_INLINE__) +#include "ace/Caching_Strategies_T.i" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Caching_Strategies_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation "ace/Caching_Strategies_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* CACHING_STRATEGIES_H */ diff --git a/ace/Caching_Strategies_T.i b/ace/Caching_Strategies_T.i new file mode 100644 index 00000000000..1b9bcf2264f --- /dev/null +++ b/ace/Caching_Strategies_T.i @@ -0,0 +1,295 @@ +/* -*-C++-*- */ +//$Id$ + +template<class CONTAINER> ACE_INLINE ACE_LRU_Caching_Strategy<CONTAINER>::ATTRIBUTES +ACE_LRU_Caching_Strategy<CONTAINER>::attributes (void) +{ + return this->timer_; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LRU_Caching_Strategy<CONTAINER>::purge_percent (void) +{ + return this->purge_percent_; +} + +template<class CONTAINER> ACE_INLINE void +ACE_LRU_Caching_Strategy<CONTAINER>::purge_percent (int percentage) +{ + this->purge_percent_ = percentage; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LRU_Caching_Strategy<CONTAINER>::notify_bind (int result, + const ATTRIBUTES &attributes) +{ + if (result == 0) + { + ++this->timer_; + ++this->entries_; + } + + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LRU_Caching_Strategy<CONTAINER>::notify_find (int result, + ATTRIBUTES &attr) +{ + if (result == 0) + { + attr = this->timer_; + ++this->timer_; + } + + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LRU_Caching_Strategy<CONTAINER>::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LRU_Caching_Strategy<CONTAINER>::notify_trybind (int result, + ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LRU_Caching_Strategy<CONTAINER>::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + if (result == 0) + ++this->timer_; + + return result; +} + +template<class CONTAINER> ACE_INLINE void +ACE_LRU_Caching_Strategy<CONTAINER>::dump (void) const +{ + ACE_TRACE ("ACE_LRU_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("timer_ = %d "), this->timer_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +////////////////////////////////////////////////////////////////////////////////// + +template<class CONTAINER> ACE_INLINE ACE_LFU_Caching_Strategy<CONTAINER>::ATTRIBUTES +ACE_LFU_Caching_Strategy<CONTAINER>::attributes (void) +{ + return 0; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LFU_Caching_Strategy<CONTAINER>::purge_percent (void) +{ + return this->purge_percent_; +} + +template<class CONTAINER> ACE_INLINE void +ACE_LFU_Caching_Strategy<CONTAINER>::purge_percent (int percentage) +{ + this->purge_percent_ = percentage; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LFU_Caching_Strategy<CONTAINER>::notify_bind (int result, + const ATTRIBUTES &attr) +{ + if (result == 0) + ++this->entries_; + + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LFU_Caching_Strategy<CONTAINER>::notify_find (int result, + ATTRIBUTES &attr) +{ + if (result == 0) + ++attr; + + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LFU_Caching_Strategy<CONTAINER>::notify_trybind (int result, + ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_LFU_Caching_Strategy<CONTAINER>::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + if (result == 0) + ++this->entries_; + + return result; +} +template<class CONTAINER> ACE_INLINE int +ACE_LFU_Caching_Strategy<CONTAINER>::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE void +ACE_LFU_Caching_Strategy<CONTAINER>::dump (void) const +{ + ACE_TRACE ("ACE_LFU_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +////////////////////////////////////////////////////////////////////////////////////// + +template<class CONTAINER> ACE_INLINE ACE_FIFO_Caching_Strategy<CONTAINER>::ATTRIBUTES +ACE_FIFO_Caching_Strategy<CONTAINER>::attributes (void) +{ + return this->order_; +} +template<class CONTAINER> ACE_INLINE int +ACE_FIFO_Caching_Strategy<CONTAINER>::purge_percent (void) +{ + return this->purge_percent_; +} + +template<class CONTAINER> ACE_INLINE void +ACE_FIFO_Caching_Strategy<CONTAINER>::purge_percent (int percentage) +{ + this->purge_percent_ = percentage; +} + +template<class CONTAINER> ACE_INLINE int +ACE_FIFO_Caching_Strategy<CONTAINER>::notify_bind (int result, + const ATTRIBUTES &attr) +{ + if (result == 0) + { + ++this->order_; + ++this->entries_; + } + + return result; +} + + +template<class CONTAINER> ACE_INLINE int +ACE_FIFO_Caching_Strategy<CONTAINER>::notify_find (int result, + ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_FIFO_Caching_Strategy<CONTAINER>::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_FIFO_Caching_Strategy<CONTAINER>::notify_trybind (int result, + ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_FIFO_Caching_Strategy<CONTAINER>::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + if (result == 0) + { + ++this->order_; + ++this->entries_; + } + + return result; +} + + +template<class CONTAINER> ACE_INLINE void +ACE_FIFO_Caching_Strategy<CONTAINER>::dump (void) const +{ + ACE_TRACE ("ACE_FIFO_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("order_ = %d "), this->order_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +////////////////////////////////////////////////////////////////////////////////// + +template<class CONTAINER> ACE_INLINE ACE_Null_Caching_Strategy<CONTAINER>::ATTRIBUTES +ACE_Null_Caching_Strategy<CONTAINER>::attributes (void) +{ + return 0; +} + +template<class CONTAINER> ACE_INLINE int +ACE_Null_Caching_Strategy<CONTAINER>::purge_percent (void) +{ + return 0; +} + +template<class CONTAINER> ACE_INLINE void +ACE_Null_Caching_Strategy<CONTAINER>::purge_percent (int percentage) +{ +} + +template<class CONTAINER> ACE_INLINE int +ACE_Null_Caching_Strategy<CONTAINER>::notify_bind (int result, + const ATTRIBUTES &attr) +{ + return result; +} +template<class CONTAINER> ACE_INLINE int +ACE_Null_Caching_Strategy<CONTAINER>::notify_find (int result, + ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_Null_Caching_Strategy<CONTAINER>::notify_unbind (int result, + const ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_Null_Caching_Strategy<CONTAINER>::notify_trybind (int result, + ATTRIBUTES &attr) +{ + return result; +} + +template<class CONTAINER> ACE_INLINE int +ACE_Null_Caching_Strategy<CONTAINER>::notify_rebind (int result, + const ATTRIBUTES &attr) +{ + return result; +} + + +template<class CONTAINER> ACE_INLINE void +ACE_Null_Caching_Strategy<CONTAINER>::dump (void) const +{ + ACE_TRACE ("ACE_Null_Caching_Strategy::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +////////////////////////////////////////////////////////////////////////////////// |