

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.net-snmp.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Stash_cache</id>
		<title>Stash cache - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.net-snmp.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Stash_cache"/>
		<link rel="alternate" type="text/html" href="http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;action=history"/>
		<updated>2026-05-05T04:22:40Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;diff=5214&amp;oldid=prev</id>
		<title>Wes: /* Internal Details */</title>
		<link rel="alternate" type="text/html" href="http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;diff=5214&amp;oldid=prev"/>
				<updated>2011-07-15T22:41:47Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Internal Details&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&#039;diff diff-contentalign-left&#039;&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;tr style=&#039;vertical-align: top;&#039; lang=&#039;en&#039;&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 22:41, 15 July 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l38&quot; &gt;Line 38:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 38:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If the cache is present and recent, it will answer it and not call the lower handlers&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If the cache is present and recent, it will answer it and not call the lower handlers&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If the cache is out of date, it will create a new request with a special internal mode (&amp;#039;&amp;#039;MODE_GET_STASH&amp;#039;&amp;#039;)).&amp;#160; The lower helper should extract the passed in [[oid_stash]] pointer and fill it with a complete copy of the table&amp;#039;s data.&amp;#160; IE, the lower handle doesn&amp;#039;t just return a portion of the information, it needs to return &amp;#039;&amp;#039;&amp;#039;everything&amp;#039;&amp;#039;&amp;#039;!&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* If the cache is out of date, it will create a new request with a special internal mode (&amp;#039;&amp;#039;MODE_GET_STASH&amp;#039;&amp;#039;)).&amp;#160; The lower helper should extract the passed in [[oid_stash]] pointer and fill it with a complete copy of the table&amp;#039;s data.&amp;#160; IE, the lower handle doesn&amp;#039;t just return a portion of the information, it needs to return &amp;#039;&amp;#039;&amp;#039;everything&amp;#039;&amp;#039;&amp;#039;!&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Graphical Handler Chain ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Graphically, before the stash_cache gets inserted the chain likely looks like this:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Image:before-stash-cache.png]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;And afterward:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Image:after-stash-cache.png]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wes</name></author>	</entry>

	<entry>
		<id>http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;diff=5213&amp;oldid=prev</id>
		<title>Wes at 20:59, 15 July 2011</title>
		<link rel="alternate" type="text/html" href="http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;diff=5213&amp;oldid=prev"/>
				<updated>2011-07-15T20:59:23Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&#039;diff diff-contentalign-left&#039;&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;col class=&#039;diff-marker&#039; /&gt;
				&lt;col class=&#039;diff-content&#039; /&gt;
				&lt;tr style=&#039;vertical-align: top;&#039; lang=&#039;en&#039;&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&#039;2&#039; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 20:59, 15 July 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{helper|Stash Cache|code=agent/helpers/stash_cache.c}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{helper|Stash Cache|code=agent/helpers/stash_cache.c&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|documentation=stash__cache&lt;/ins&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;#039;&amp;#039;&amp;#039;stash_cache&amp;#039;&amp;#039;&amp;#039; [[handler]] that can be injected either pragmatically or at run-time through the &amp;#039;injectHandler&amp;#039; [[snmpd.conf]] configuration directive.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;#039;&amp;#039;&amp;#039;stash_cache&amp;#039;&amp;#039;&amp;#039; [[handler]] that can be injected either pragmatically or at run-time through the &amp;#039;injectHandler&amp;#039; [[snmpd.conf]] configuration directive.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wes</name></author>	</entry>

	<entry>
		<id>http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;diff=5210&amp;oldid=prev</id>
		<title>Wes: Created page with &quot;{{helper|Stash Cache|code=agent/helpers/stash_cache.c}}  The &#039;&#039;&#039;stash_cache&#039;&#039;&#039; handler that can be injected either pragmatically or at run-time through the &#039;injectHandler&#039; [[...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.net-snmp.org/wiki/index.php?title=Stash_cache&amp;diff=5210&amp;oldid=prev"/>
				<updated>2011-07-15T20:52:50Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{helper|Stash Cache|code=agent/helpers/stash_cache.c}}  The &amp;#039;&amp;#039;&amp;#039;stash_cache&amp;#039;&amp;#039;&amp;#039; &lt;a href=&quot;/wiki/index.php/Handler&quot; title=&quot;Handler&quot;&gt;handler&lt;/a&gt; that can be injected either pragmatically or at run-time through the &amp;#039;injectHandler&amp;#039; [[...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{helper|Stash Cache|code=agent/helpers/stash_cache.c}}&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;stash_cache&amp;#039;&amp;#039;&amp;#039; [[handler]] that can be injected either pragmatically or at run-time through the &amp;#039;injectHandler&amp;#039; [[snmpd.conf]] configuration directive.&lt;br /&gt;
&lt;br /&gt;
The purpose of the handler is to cache information from the lower sources, store it in an extremely fast searchable hash-tree, and return it to the agent any time new requests come in.  The &amp;#039;&amp;#039;stash_cache&amp;#039;&amp;#039; handler needs to be injected above any table helper that takes care of normally returning data.  Once the data is cached, it won&amp;#039;t query the lower table handler again until the cache expires.&lt;br /&gt;
&lt;br /&gt;
== Handler Types that Support The stash_cache ==&lt;br /&gt;
&lt;br /&gt;
Right now the stash_cache is only usable with these handler types:&lt;br /&gt;
&lt;br /&gt;
* [[table_iterator]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Programatically ===&lt;br /&gt;
&lt;br /&gt;
In the modules code you can inject the handler as follows (usually after it&amp;#039;s fully registered):&lt;br /&gt;
&lt;br /&gt;
  netsnmp_inject_handler_before(tptr-&amp;gt;reginfo,&lt;br /&gt;
                                netsnmp_get_bare_stash_cache_handler(),&lt;br /&gt;
                                _clone_handler(handler),&lt;br /&gt;
                                &amp;quot;table_iterator&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
You can also use the &amp;#039;&amp;#039;netsnmp_get_timed_bare_stash_cache_handler(...)&amp;#039;&amp;#039; function to create a handler with more specific timing parameters.&lt;br /&gt;
&lt;br /&gt;
=== snmpd.conf ===&lt;br /&gt;
&lt;br /&gt;
For tables that are implemented using a compliant handler, you can insert the stash cache at run-time using the following snmpd.conf syntax:&lt;br /&gt;
&lt;br /&gt;
  injectHandler stash_cache &amp;#039;&amp;#039;TABLE_NAME&amp;#039;&amp;#039; table_iterator&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;table_iterator&amp;#039;&amp;#039; portion tells [[snmpd]] to inject the handler before the &amp;#039;&amp;#039;table_iterator&amp;#039;&amp;#039; part of the chain, which is required.  Substitute a different handler type if the module is implemented using a different handler type.&lt;br /&gt;
&lt;br /&gt;
== Internal Details ==&lt;br /&gt;
&lt;br /&gt;
Internally, the stash cache intercepts GET and GETNEXT requests being sent down the handler chain.  It will then:&lt;br /&gt;
&lt;br /&gt;
* If the cache is present and recent, it will answer it and not call the lower handlers&lt;br /&gt;
* If the cache is out of date, it will create a new request with a special internal mode (&amp;#039;&amp;#039;MODE_GET_STASH&amp;#039;&amp;#039;)).  The lower helper should extract the passed in [[oid_stash]] pointer and fill it with a complete copy of the table&amp;#039;s data.  IE, the lower handle doesn&amp;#039;t just return a portion of the information, it needs to return &amp;#039;&amp;#039;&amp;#039;everything&amp;#039;&amp;#039;&amp;#039;!&lt;/div&gt;</summary>
		<author><name>Wes</name></author>	</entry>

	</feed>