text: /************************************************************************************
   * ds_ecmcdrcache.h                                                                 *
   *                                                                                  *
   * Created: July 17, 2013                                                           *
   * Author:  limyanto                                                                *
   * Copyright 2013 <JDS Uniphase Corp>                                               *
   ************************************************************************************/
  #ifndef XTREME_DATASERVICE_DS_ECMCDRCACHE_H_
  #define XTREME_DATASERVICE_DS_ECMCDRCACHE_H_
  
  #include "xtreme/common/enrichdata_types.h"
  #include "xtreme/dataservice/ds_lru.h"
  #include "xtreme/dataservice/internal/ds_enrichdata_impl.h"
  
  namespace xtreme {
  
  class ecmCdrCacheLRU : public LRU<uint64_t, ecmCdrPtr> {
    public:
      explicit ecmCdrCacheLRU(uint32_t capacity) : LRU<uint64_t, ecmCdrPtr>(capacity) {
      }
      ~ecmCdrCacheLRU(void) {
          DetachAll();
      }
      ecmCdrPtr& Retrieve(uint64_t key, bool* newadd = NULL) {
          return LRU<uint64_t, ecmCdrPtr>::Retrieve(key, newadd);
      }
      void Attach(uint64_t key, ecmCdrPtr& value) {
          value.reset(new ecmCdrStruct);
      }
      void Detach(uint64_t key, ecmCdrPtr& value) {
      }
  };
  
  class ecmEdrCacheLRU : public LRU<uint64_t, ecmEdrPtr> {
    public:
      explicit ecmEdrCacheLRU(uint32_t capacity) : LRU<uint64_t, ecmEdrPtr>(capacity) {
      }
      ~ecmEdrCacheLRU(void) {
          DetachAll();
      }
      ecmEdrPtr& Retrieve(uint64_t key, bool* newadd = NULL) {
          return LRU<uint64_t, ecmEdrPtr>::Retrieve(key, newadd);
      }
      void Attach(uint64_t key, ecmEdrPtr& value) {
          value.reset(new ecmEdrStruct);
      }
      void Detach(uint64_t key, ecmEdrPtr& value) {
      }
  };
  }
  #endif  // XTREME_DATASERVICE_DS_ECMCDRCACHE_H_
  
  