# moviefun-jcache
**Repository Path**: mirrors_tomitribe/moviefun-jcache
## Basic Information
- **Project Name**: moviefun-jcache
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-26
- **Last Updated**: 2026-02-08
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
= Moviefun-JCache
This project demonstrates using JCache, CDI and Hazelcast to add a clustered cache to an existing Java EE project.
This GitHub repository features two branches - one showing the application before adding caching (+master+) and one
after adding caching (+jcache-hazelcast+).
This project makes use of a small CDI extension - https://github.com/tomitribe/jcache-cdi, standard JCache JSR-107
annotations and interceptors from the JCache reference implementation.
This project aims to show how you can add caching to your application using these tools as simply as possible.
Adding caching to the application requires the following steps:
== Adding dependencies
Add the following dependencies to the project's pom.xml:
[source,xml,numbered]
----
javax.cache
cache-api
1.0.0
com.hazelcast
hazelcast
3.4.1
org.tomitribe
jcache-cdi
0.1-SNAPSHOT
----
This example uses Hazelcast as the JCache provider.
== Ensure the project has a +beans.xml+ file:
----
----
== Add annotations to the MoviesBean EJB
Note the use of +@CacheResult+, +@CachePut+, +@CacheRemove+.
The +Cache+ instances can also be injected and manipulated directly - for this, the project has used a CDI +Producer+ -
+CacheFactory+. Three caches are injected into fields in MoviesBean, and are cleared directly in the +resetCaches+ method
to remove any invalid entries when the database is updated.