NCBI C++ ToolKit
cgiapp_cached.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: cgiapp_cached.cpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Eugene Vasilchenko, Denis Vakatov, Anatoliy Kuznetsov
27 *
28 * File Description:
29 * Definition CGI application class and its context class.
30 */
31 
32 #include <ncbi_pch.hpp>
34 #include <cgi/cgiapp_cached.hpp>
35 
36 #include <util/cache/icache.hpp>
37 
39 
40 NCBI_PARAM_DEF(string, CGI, ResultCacheSectionName, "result_cache");
41 
43  : m_CacheTreeParams(NULL)
44 {
45 }
46 
48 {
49 }
50 
51 
53 {
55 
57  if (params) {
58  const TPluginManagerParamTree* cache_tree =
59  params->FindSubNode(TCGI_ResultCacheSectionName::GetDefault());
60  if (cache_tree) {
61  const TPluginManagerParamTree* driver_tree =
62  cache_tree->FindSubNode("driver");
63  if (driver_tree && !driver_tree->GetValue().value.empty()) {
64  m_CacheDriverName = driver_tree->GetValue().value;
66  }
67  }
68  }
69 }
70 
71 
73 {
74  if (!m_CacheTreeParams || m_CacheDriverName.empty() )
75  return NULL;
76 
77  typedef CPluginManager<ICache> TCacheManager;
78  typedef CPluginManagerGetter<ICache> TCacheManagerStore;
79 
81 
82  _ASSERT( cache_manager );
83 
84  return cache_manager->CreateInstance(
88  );
89 }
90 
NCBI_PARAM_DEF(string, CGI, ResultCacheSectionName, "result_cache")
CPluginManager<> –.
CRef –.
Definition: ncbiobj.hpp:618
definition of a Culling tree
Definition: ncbi_tree.hpp:100
BLOB cache read/write/maintenance interface.
Definition: icache.hpp:64
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
virtual void Init(void)
This method is called on the CGI application initialization – before starting to process a HTTP reque...
Definition: cgiapp.cpp:864
const TPluginManagerParamTree * m_CacheTreeParams
void Init(void) override
This method is called on the CGI application initialization – before starting to process a HTTP reque...
ICache * GetCacheStorage() const override
CGI
Definition: cgiapp.hpp:685
#define NULL
Definition: ncbistd.hpp:225
static TParamTree * ConvertRegToTree(const IRegistry &reg, NStr::ECase use_case=NStr::eNocase)
Reconstruct param tree from the application registry.
#define NCBI_INTERFACE_VERSION(iface)
Macro to construct CVersionInfo class using interface name (relies on CInterfaceVersion class)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const TTreeType * FindSubNode(const TKeyType &key) const
Non recursive linear scan of all subnodes, with key comparison.
Definition: ncbi_tree.hpp:940
const TValue & GetValue(void) const
Return node's value.
Definition: ncbi_tree.hpp:184
Interfaces for a local cache of versioned binary large objects (BLOBS).
const TYPE & Get(const CNamedParameterList *param)
#define _ASSERT
Modified on Thu Jun 13 17:25:57 2024 by modify_doxy.py rev. 669887