blob: b3b1ac0f371c5f20b191ccde5a0f675c7714af5b [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Apache Geode Native C++ Reference: apache::geode::client::CacheLoader Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Apache Geode Native C++ Reference
&#160;<span id="projectnumber">1.13.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00379.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<div class="title">apache::geode::client::CacheLoader Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>An application plug-in that can be installed on a region.
<a href="a00379.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a78128df22aca9cee08dc684fe98f5327"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00379.html#a78128df22aca9cee08dc684fe98f5327">close</a> (<a class="el" href="a00815.html">Region</a> &amp;rp)</td></tr>
<tr class="memdesc:a78128df22aca9cee08dc684fe98f5327"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the region containing this callback is destroyed, when the cache is closed. <a href="#a78128df22aca9cee08dc684fe98f5327">More...</a><br /></td></tr>
<tr class="separator:a78128df22aca9cee08dc684fe98f5327"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa79596f50779a0532a13638c2a85c90e"><td class="memItemLeft" align="right" valign="top">virtual std::shared_ptr&lt; <a class="el" href="a00855.html">Cacheable</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00379.html#aa79596f50779a0532a13638c2a85c90e">load</a> (<a class="el" href="a00815.html">Region</a> &amp;rp, const std::shared_ptr&lt; <a class="el" href="a00339.html">CacheableKey</a> &gt; &amp;key, const std::shared_ptr&lt; <a class="el" href="a00855.html">Serializable</a> &gt; &amp;aCallbackArgument)=0</td></tr>
<tr class="memdesc:aa79596f50779a0532a13638c2a85c90e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Loads a value. <a href="#aa79596f50779a0532a13638c2a85c90e">More...</a><br /></td></tr>
<tr class="separator:aa79596f50779a0532a13638c2a85c90e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An application plug-in that can be installed on a region. </p>
<p>Loaders facilitate loading of data into the cache. When an application does a lookup for a key in a region and it does not exist, the system checks to see if any loaders are available for the region in the system and invokes them to get the value for the key into the cache. Allows data to be loaded from a 3rd party data source and placed into the region When <a class="el" href="a00815.html#a4423292be4f114db87bc14bcf026a9f7">Region::get</a> is called for a region entry that has a <code>nullptr</code> value, the <a class="el" href="a00379.html#aa79596f50779a0532a13638c2a85c90e">CacheLoader::load</a> method of the region's cache loader is invoked. The <code>load</code> method creates the value for the desired key by performing an operation such as a database query.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00823.html#a2bf15be71c0e57fec59d73bdd7a3b0c2" title="Sets the cache loader for the next RegionAttributes created.">RegionAttributesFactory::setCacheLoader</a> </dd>
<dd>
<a class="el" href="a00819.html#a05acc3f27725cedb124d6971f51e47cd" title="public static methods">RegionAttributes::getCacheLoader</a> </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a78128df22aca9cee08dc684fe98f5327"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a78128df22aca9cee08dc684fe98f5327">&#9670;&nbsp;</a></span>close()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void apache::geode::client::CacheLoader::close </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00815.html">Region</a> &amp;&#160;</td>
<td class="paramname"><em>rp</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when the region containing this callback is destroyed, when the cache is closed. </p>
<p>Implementations should clean up any external resources, such as database connections. Any runtime exceptions this method throws will be logged.</p>
<p>It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">rp</td><td>the region pointer</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00287.html#a709c65fc2cd45f67ce3d6603df9bc7f1" title="Terminates this object cache and releases all the local resources.">Cache::close</a> </dd>
<dd>
<a class="el" href="a00815.html#a0e00376744c98bc9d2db341a865c69a3" title="Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in ...">Region::destroyRegion</a> </dd></dl>
</div>
</div>
<a id="aa79596f50779a0532a13638c2a85c90e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa79596f50779a0532a13638c2a85c90e">&#9670;&nbsp;</a></span>load()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual std::shared_ptr&lt;<a class="el" href="a00855.html">Cacheable</a>&gt; apache::geode::client::CacheLoader::load </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00815.html">Region</a> &amp;&#160;</td>
<td class="paramname"><em>rp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::shared_ptr&lt; <a class="el" href="a00339.html">CacheableKey</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>key</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::shared_ptr&lt; <a class="el" href="a00855.html">Serializable</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>aCallbackArgument</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Loads a value. </p>
<p>Application writers should implement this method to customize the loading of a value. This method is called by the caching service when the requested value is not in the cache. Any exception thrown by this method is propagated back to and thrown by the invocation of <a class="el" href="a00815.html#a4423292be4f114db87bc14bcf026a9f7">Region::get</a> that triggered this load. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">rp</td><td>a <a class="el" href="a00815.html" title="This class manages subregions and cached data.">Region</a> Pointer for which this is called. </td></tr>
<tr><td class="paramname">key</td><td>the key for the cacheable </td></tr>
<tr><td class="paramname">helper</td><td>any related user data, or nullptr </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the value supplied for this key, or nullptr if no value can be supplied.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00815.html#a4423292be4f114db87bc14bcf026a9f7" title="Returns the value associated with the specified key, passing the callback argument to any cache loade...">Region::get</a> . </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<HR><address style="align: right;"><small>Apache Geode C++ Cache API Documentation</small></address>