WSO2 Carbon Caching - Tests

WSO2 is an open source application development software company focused on providing service-oriented architecture solutions for professional developers.

License

License

Categories

Categories

Caching Data
GroupId

GroupId

org.wso2.carbon.caching
ArtifactId

ArtifactId

carbon-caching-tests
Last Version

Last Version

1.1.3
Release Date

Release Date

Type

Type

pom
Description

Description

WSO2 Carbon Caching - Tests
WSO2 is an open source application development software company focused on providing service-oriented architecture solutions for professional developers.
Project URL

Project URL

http://wso2.com
Project Organization

Project Organization

WSO2

Download carbon-caching-tests

How to add to project

<!-- https://jarcasting.com/artifacts/org.wso2.carbon.caching/carbon-caching-tests/ -->
<dependency>
    <groupId>org.wso2.carbon.caching</groupId>
    <artifactId>carbon-caching-tests</artifactId>
    <version>1.1.3</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/org.wso2.carbon.caching/carbon-caching-tests/
implementation 'org.wso2.carbon.caching:carbon-caching-tests:1.1.3'
// https://jarcasting.com/artifacts/org.wso2.carbon.caching/carbon-caching-tests/
implementation ("org.wso2.carbon.caching:carbon-caching-tests:1.1.3")
'org.wso2.carbon.caching:carbon-caching-tests:pom:1.1.3'
<dependency org="org.wso2.carbon.caching" name="carbon-caching-tests" rev="1.1.3">
  <artifact name="carbon-caching-tests" type="pom" />
</dependency>
@Grapes(
@Grab(group='org.wso2.carbon.caching', module='carbon-caching-tests', version='1.1.3')
)
libraryDependencies += "org.wso2.carbon.caching" % "carbon-caching-tests" % "1.1.3"
[org.wso2.carbon.caching/carbon-caching-tests "1.1.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • test-distribution
  • osgi-tests

JSR 107 (JCache) Implementation for WSO2 Carbon

This Carbon component implements JCache 1.0 for Carbon.

For details about JCache, see the specification

Usage

Example usage:

Creating a Cache

CachingProvider provider = cachingService.getCachingProvider();
CacheManager cacheManager = provider.getCacheManager();
        
//configure the cache
MutableConfiguration<String, String> config = new MutableConfiguration<>();
config.setStoreByValue(true)
        .setTypes(String.class, String.class)
        .setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(cacheExpiry))
        .setStatisticsEnabled(false);

//create the cache
Cache<String, String> = cacheManager.createCache("myCache", config);

Note that cachingService in the above code segment is the org.wso2.carbon.caching.CarbonCachingService OSGi service

Getting the cache and performing operations on it

String cacheName = "myCache";
String key = "k";
String value = "v";
Cache<String, String> cache = cacheManager.getCache(cacheName, String.class, String.class);

// Add to cache
cache.put(key, value);

// Get from cache
String val = cache.get(key);

// Remove from cache
cache.remove(key);

For full source code, see caching sample.

For more details about the JCache APIs, please refer to the JCache Java docs

org.wso2.carbon.caching

WSO2

Welcome to the WSO2 source code! For info on working with the WSO2 repositories and contributing code, click the link below.

Versions

Version
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
1.0.0-m1