Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Leen Toelen committed Nov 10, 2011
1 parent a8d6394 commit 0f149d1
Show file tree
Hide file tree
Showing 15 changed files with 2,435 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>spymemcached-jcache</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Thu Nov 10 08:25:21 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5 changes: 5 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Thu Nov 10 08:22:50 CET 2011
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
47 changes: 47 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>github.com</groupId>
<artifactId>spymemcached-jcache</artifactId>
<packaging>jar</packaging>
<version>0.4-SNAPSHOT</version>

<name>JSR107 Cache implementation for spymemcached</name>

<dependencies>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>0.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0-SP4</version>
</dependency>
<dependency>
<groupId>spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>files.couchbase.com</id>
<url>http://files.couchbase.com/maven2/</url>
</repository>
</repositories>
</project>
151 changes: 151 additions & 0 deletions src/main/java/net/spy/memcached/jcache/SimpleCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/**
* Copyright 2011 Terracotta, Inc.
* Copyright 2011 Oracle America Incorporated
*
* Licensed 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.
*/

package net.spy.memcached.jcache;

import java.util.Map;

/**
*
* @param <K>
* the type of keys maintained by this cache
* @param <V>
* the type of cached values
*/
interface SimpleCache<K, V> extends Iterable<Map.Entry<K, V>> {

/**
* @param key
* the key
* @return the value
* @see javax.cache.Cache#get(Object)
*/
V get(Object key);

/**
* @param key
* the key
* @return true if exists
* @see javax.cache.Cache#containsKey(Object)
*/
boolean containsKey(Object key);

/**
* @param key
* the key
* @param value
* the valu
* @see javax.cache.Cache#put(Object, Object)
*/
void put(K key, V value);

/**
* @param key
* the key
* @param value
* the value
* @return the old value
* @see javax.cache.Cache#getAndPut(Object, Object)
*/
V getAndPut(K key, V value);

/**
* @param map
* the map of key/values
* @see javax.cache.Cache#putAll(java.util.Map)
*/
void putAll(Map<? extends K, ? extends V> map);

/**
* @param key
* the key
* @param value
* the value
* @return true if replace happened
* @see javax.cache.Cache#putIfAbsent(Object, Object)
*/
boolean putIfAbsent(K key, V value);

/**
* @param key
* the key
* @return true if removed
* @see javax.cache.Cache#remove(Object)
*/
boolean remove(Object key);

/**
* @param key
* the key
* @param oldValue
* the old value to be checked
* @return true if removed
* @see javax.cache.Cache#remove(Object)
*/
boolean remove(Object key, V oldValue);

/**
* @param key
* the key
* @return the previous value
* @see javax.cache.Cache#getAndRemove(Object)
*/
V getAndRemove(Object key);

/**
* @param key
* the key
* @param oldValue
* old value
* @param newValue
* new value
* @return whether replace happened
* @see javax.cache.Cache#replace(Object, Object, Object)
*/
boolean replace(K key, V oldValue, V newValue);

/**
* @param key
* the key
* @param value
* the value
* @return whether replaced
* @see javax.cache.Cache#replace(Object, Object)
*/
boolean replace(K key, V value);

/**
* @param key
* the key
* @param value
* the new value
* @return the old value
* @see javax.cache.Cache#replace(Object, Object)
*/
V getAndReplace(K key, V value);

/**
* @return the size
* @see java.util.Map#size()
*/
int size();

/**
* @see javax.cache.Cache#removeAll()
*/
void removeAll();
}
Loading

0 comments on commit 0f149d1

Please sign in to comment.