blob: 596c56a7f687ba55041bfd6287f3e4ced3f14b76 [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.8.1 from src/site/asciidoc/index.adoc.vm
| Rendered using Apache Maven Fluido Skin 1.7
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Language" content="en" />
<title>Spring Cache Component &#x2013; </title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/site.css">
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-140879-5']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="topBarEnabled">
<a href="https://github.com/apache/archiva-components">
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
alt="Fork me on GitHub">
</a>
<div id="topbar" class="navbar navbar-fixed-top ">
<div class="navbar-inner">
<div class="container"><div class="nav-collapse">
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Modules <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="archiva-components-spring-cache-api/index.html" title="Archiva Components :: Spring Cache API">Archiva Components :: Spring Cache API</a></li>
<li><a href="archiva-components-spring-cache-test/index.html" title="Archiva Components :: Spring Cache Tests">Archiva Components :: Spring Cache Tests</a></li>
<li><a href="archiva-components-spring-cache-providers/index.html" title="Archiva Components :: Spring Cache Providers">Archiva Components :: Spring Cache Providers</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Project Documentation <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a href="project-info.html" title="Project Information">Project Information</a>
<ul class="dropdown-menu">
<li><a href="index.html" title="About">About</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a href="project-reports.html" title="Project Reports">Project Reports</a>
<ul class="dropdown-menu">
<li><a href="apidocs/index.html" title="Javadoc">Javadoc</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<form id="search-form" action="https://www.google.com/search" method="get" class="navbar-search pull-right" >
<input value="http://archiva.apache.org/components" name="sitesearch" type="hidden"/>
<input class="search-query" name="q" id="query" type="text" />
</form>
<script type="text/javascript">asyncJs( 'https://cse.google.com/brand?form=search-form' )</script>
<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">External Links <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="../../index.html" title="Archiva">Archiva</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div id="banner">
<div class="pull-left"><a href="http://archiva.apache.org/index.html" id="bannerLeft"><img src="http://archiva.apache.org/images/archiva.png" alt="Apache Archiva"/></a></div>
<div class="pull-right"><a href="http://www.apache.org/" id="bannerRight"><img src="http://www.apache.org/images/asf_logo_wide_2016.png" alt="Apache Software Foundation"/></a></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li class=""><a href="../../index.html" title="Archiva">Archiva</a><span class="divider">/</span></li>
<li class=""><a href="../index.html" title="Archiva Components">Archiva Components</a><span class="divider">/</span></li>
<li class=""><a href="index.html" title="Spring Cache">Spring Cache</a><span class="divider">/</span></li>
<li class="active "></li>
</ul>
</div>
<div id="bodyColumn" >
<h1>Spring Cache</h1>
<div class="sect1">
<h2 id="overview">Overview</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Purpose of this module is to provide a cache api with differents providers. Currently the following
cache providers are contained in the module:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>simple hashmap</p>
</li>
<li>
<p>ehcache</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="use_case">Use Case</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Typical use case for this API could be the following : you have an functionnal API which create objects by
using a requirement on a DAO plexus components. Before asking the DAO layer (webServices, Jdbc access &#8230;&#8203;),
you want to ask if the data exists in a cache if yes the cached value is return if not the DAO layer is used
and the result put in the cache for future use.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="test_case_sample">Test Case Sample</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Look at the test case <code>AbstractTestWineService</code> in the module spring-cache-test. A service called <code>WineService</code>
explains this. The default implementation has two requirements :</p>
</div>
<div class="ulist">
<ul>
<li>
<p>WineDao (DAO layer)</p>
</li>
<li>
<p>CacheBuilder</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>CacheBuilder can build a cache for the bean you ask (in the sample it&#8217;s Wine)
cacheBuilder.getCache( Wine.class )
This will use the following algorithm to provide the Cache implementation :</p>
</div>
<div class="ulist">
<ul>
<li>
<p>search the Spring Cache with roleHint <code>Wine.class.getName()</code></p>
</li>
<li>
<p>if not found : lookup the Spring component Cache with name <code>cache#default</code></p>
</li>
<li>
<p>if not found : return <code>NoCacheCache</code> implementation in order to prevent NPE</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="submodules">Submodules</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p>spring-cache-api</p>
</li>
<li>
<p>spring-cache-test</p>
</li>
<li>
<p>spring-cache-providers</p>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container">
<div class="row">
<p>Copyright &copy;2006&#x2013;2019
<a href="http://www.apache.org/">The Apache Software Foundation</a>.
All rights reserved.</p>
</div>
<p id="poweredBy" class="pull-right"><a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</p>
<div id="ohloh" class="pull-right">
<script type="text/javascript" src="https://www.ohloh.net/p/6670/widgets/project_thin_badge.js"></script>
</div>
</div>
</footer>
</body>
</html>