You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:23:19 UTC

[sling-org-apache-sling-commons-cache-api] branch master created (now 3b19969)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git.


      at 3b19969  SLING-7167 Adjust READMEs

This branch includes the following new commits:

     new 5dc76ac  SLING-2555 moving into the right place this time, sorry.
     new 5722f88  SLING-2555 Adjusted the svn paths to fit the new location.
     new dd2e28f  Use latest releases and update to new parent pom
     new 5ae27b4  Update to latest parent pom and use latest releases in launchpad
     new 07662f6  Correct reactor pom and update to parent pom 16
     new 8dfe6f8  SLING-7167 Adjust READMEs
     new 3b19969  SLING-7167 Adjust READMEs

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-commons-cache-api] 03/07: Use latest releases and update to new parent pom

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit dd2e28f6796bab5ad743ba44fec6508001bbf203
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Dec 23 06:53:35 2012 +0000

    Use latest releases and update to new parent pom
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1425425 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 59bd34c..6ea02c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>13</version>
+        <version>14</version>
     </parent>
 
     <artifactId>org.apache.sling.commons.cache.api</artifactId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-cache-api] 01/07: SLING-2555 moving into the right place this time, sorry.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit 5dc76acbba72f2ab25b5001697a1c978fe7e6246
Author: Ian Boston <ie...@apache.org>
AuthorDate: Fri Nov 9 05:22:15 2012 +0000

    SLING-2555 moving into the right place this time, sorry.
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1407364 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt                                         | 12 +++
 pom.xml                                            | 69 ++++++++++++++++
 .../org/apache/sling/commons/cache/api/Cache.java  | 92 ++++++++++++++++++++++
 .../commons/cache/api/CacheManagerService.java     | 51 ++++++++++++
 .../apache/sling/commons/cache/api/CacheScope.java | 50 ++++++++++++
 .../sling/commons/cache/api/ThreadBound.java       | 35 ++++++++
 .../sling/commons/cache/api/package-info.java      | 24 ++++++
 7 files changed, 333 insertions(+)

diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..609a1a1
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,12 @@
+Commons Cache.
+
+This is an Cache API, the implementation of which will allow applications written in Sling to cache data locally, 
+cache locally with cluster wide invalidation, and cache and replicate data. The exact nature of the cache behaviour
+depends on the implementation of the API.
+
+
+Acknowledgments
+
+This code was based on a module from Sparse Content Map 29 September 2012 (git:sha1:a222df1937434ad3f07bf6c4f60b19524a158bcb), which itself was based on a snapshot of a 
+module in Sakai Nakamura 27 Jan 2011 (git:sha1:b9d8e65b733ec7c35a3d194c9a5dc12acf13cb34). All know contributors to code in this module have been
+contacted for permission to grant license to the Apache Foundation.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..fe26b37
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+-->
+<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/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>13</version>
+    </parent>
+
+    <artifactId>org.apache.sling.commons.cache.api</artifactId>
+    <version>0.1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Sling Cache API</name>
+    <description>
+        This bundle porvides a Cache API for Sling applications to use.
+    </description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/whiteboard/ieb/cache/api</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/whiteboard/ieb/cache/api</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/whiteboard/ieb/cache/api</url>
+    </scm>
+    
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.6</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <!--  used for package-info annotations -->
+        <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+            <version>1.50.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/commons/cache/api/Cache.java b/src/main/java/org/apache/sling/commons/cache/api/Cache.java
new file mode 100644
index 0000000..20f1488
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/cache/api/Cache.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.sling.commons.cache.api;
+
+import java.util.Collection;
+
+/**
+ * A Cache managed by the cache manager.
+ */
+public interface Cache<V> {
+
+	/**
+	 * Cache an object
+	 * 
+	 * @param key
+	 *            The key with which to find the object.
+	 * @param payload
+	 *            The object to cache.
+	 * @param duration
+	 *            The time to cache the object (seconds).
+	 */
+	V put(String key, V payload);
+
+	/**
+	 * Test for a non expired entry in the cache.
+	 * 
+	 * @param key
+	 *            The cache key.
+	 * @return true if the key maps to a non-expired cache entry, false if not.
+	 */
+	boolean containsKey(String key);
+
+	/**
+	 * Get the non expired entry, or null if not there (or expired)
+	 * 
+	 * @param key
+	 *            The cache key.
+	 * @return The payload, or null if the payload is null, the key is not
+	 *         found, or the entry has expired (Note: use containsKey() to
+	 *         remove this ambiguity).
+	 */
+	V get(String key);
+
+	/**
+	 * Clear all entries.
+	 */
+	void clear();
+
+	/**
+	 * Remove this entry from the cache.
+	 * 
+	 * @param key
+	 *            The cache key.
+	 */
+	boolean remove(String key);
+
+	/**
+	 * Remove the key and any child keys from the cache, this is an expensive
+	 * operation.
+	 * 
+	 * @param key
+	 */
+	void removeChildren(String key);
+
+	/**
+	 * @return
+	 */
+	Collection<V> values();
+
+	/**
+	 * @return
+	 */
+	Collection<String> keys();
+
+}
diff --git a/src/main/java/org/apache/sling/commons/cache/api/CacheManagerService.java b/src/main/java/org/apache/sling/commons/cache/api/CacheManagerService.java
new file mode 100644
index 0000000..b40a510
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/cache/api/CacheManagerService.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.sling.commons.cache.api;
+
+/**
+ * The Cache manager provides access to all caches in the system. Caches are
+ * scoped by CacheScope and those that are bound can be unbound.
+ */
+public interface CacheManagerService {
+
+	/**
+	 * Get a cache to contain a specified type, with a defined scope. Getting a
+	 * cache of the same name in the same scope will return the same cache for
+	 * that scope. The thread invoking the method forms part of the scope for
+	 * CacheScopes THREAD or REQUEST.
+	 * 
+	 * @param <T>
+	 *            The type of the elements, but be serializable for any non
+	 *            thread bound cache.
+	 * @param name
+	 *            the name of the cache.
+	 * @param scope
+	 *            the scope of the cache.
+	 * @return the cache suitable for holding the type T
+	 */
+	<T> Cache<T> getCache(String name, CacheScope scope);
+
+	/**
+	 * Unbind the the context specified in scope.
+	 * 
+	 * @param scope
+	 */
+	void unbind(CacheScope scope);
+}
diff --git a/src/main/java/org/apache/sling/commons/cache/api/CacheScope.java b/src/main/java/org/apache/sling/commons/cache/api/CacheScope.java
new file mode 100644
index 0000000..7040431
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/cache/api/CacheScope.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.sling.commons.cache.api;
+
+/**
+ * Defines the scope of the cache
+ */
+public enum CacheScope {
+	/**
+	 * Bind the Cache to the request scope.
+	 */
+	REQUEST(),
+	/**
+	 * Bind a cache to the Thread, forever. WARNING: use with extreme caution,
+	 * as any classes referenced in this type of cache will keep classloaders
+	 * open and result in memory leaks
+	 */
+	THREAD(),
+	/**
+	 * Bind the cache to the instance, one per instance.
+	 */
+	INSTANCE(),
+	/**
+	 * Make the cache bound to the instance, but accept cluster wide
+	 * invalidations.
+	 */
+	CLUSTERINVALIDATED(),
+	/**
+	 * Replicate the cache over the whole cluster.
+	 */
+	CLUSTERREPLICATED();
+
+}
diff --git a/src/main/java/org/apache/sling/commons/cache/api/ThreadBound.java b/src/main/java/org/apache/sling/commons/cache/api/ThreadBound.java
new file mode 100644
index 0000000..13fe116
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/cache/api/ThreadBound.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.sling.commons.cache.api;
+
+/**
+ * Objects that are added to a ThreadLocalManager, that implement this method
+ * will have the unbind method called when the object is ejected from the thread
+ * local.
+ * 
+ */
+public interface ThreadBound {
+
+	/**
+	 * Invoked when the item is unbound from the thread.
+	 */
+	void unbind();
+
+}
diff --git a/src/main/java/org/apache/sling/commons/cache/api/package-info.java b/src/main/java/org/apache/sling/commons/cache/api/package-info.java
new file mode 100644
index 0000000..e853d9c
--- /dev/null
+++ b/src/main/java/org/apache/sling/commons/cache/api/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+@Version("1.0")
+package org.apache.sling.commons.cache.api;
+
+import aQute.bnd.annotation.Version;
+

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-cache-api] 02/07: SLING-2555 Adjusted the svn paths to fit the new location.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit 5722f887a82d57686de1a7721615a6486090dbd4
Author: Ian Boston <ie...@apache.org>
AuthorDate: Fri Nov 9 05:29:25 2012 +0000

    SLING-2555 Adjusted the svn paths to fit the new location.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1407365 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index fe26b37..59bd34c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,9 +36,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/whiteboard/ieb/cache/api</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/whiteboard/ieb/cache/api</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/whiteboard/ieb/cache/api</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/contrib/extensions/cache/api</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/contrib/extensions/cache/api</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/contrib/extensions/cache/api</url>
     </scm>
     
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-cache-api] 05/07: Correct reactor pom and update to parent pom 16

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit 07662f62251fe5104c64208064c85fd60bd68fe2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun May 5 14:38:24 2013 +0000

    Correct reactor pom and update to parent pom 16
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1479333 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 0636409..8f0e9e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>15</version>
+        <version>16</version>
     </parent>
 
     <artifactId>org.apache.sling.commons.cache.api</artifactId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-cache-api] 04/07: Update to latest parent pom and use latest releases in launchpad

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit 5ae27b4f9893f18baa1290d36e96f5b0e3531b1e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Feb 18 08:38:52 2013 +0000

    Update to latest parent pom and use latest releases in launchpad
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1447147 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 6ea02c1..0636409 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>14</version>
+        <version>15</version>
     </parent>
 
     <artifactId>org.apache.sling.commons.cache.api</artifactId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-cache-api] 06/07: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit 8dfe6f8b013e92c527ccd575b196b12e0ef4439c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Oct 2 16:17:54 2017 +0000

    SLING-7167 Adjust READMEs
    
    switch from plain text to Markdown
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810504 13f79535-47bb-0310-9956-ffa450edef68
---
 README.txt => README.md | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/README.txt b/README.md
similarity index 100%
rename from README.txt
rename to README.md

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-commons-cache-api] 07/07: SLING-7167 Adjust READMEs

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-cache-api.git

commit 3b19969aa91a3699e9c52ef22d73d6169ab9f1ea
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Oct 3 10:03:01 2017 +0000

    SLING-7167 Adjust READMEs
    
    add uniform header linking to Sling project
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1810893 13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 4 +++-
 pom.xml   | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 609a1a1..a5a97f2 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
-Commons Cache.
+# Apache Sling Commons Cache API
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
 
 This is an Cache API, the implementation of which will allow applications written in Sling to cache data locally, 
 cache locally with cluster wide invalidation, and cache and replicate data. The exact nature of the cache behaviour
diff --git a/pom.xml b/pom.xml
index 8f0e9e1..9878390 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
     <version>0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <name>Apache Sling Cache API</name>
+    <name>Apache Sling Commons Cache API</name>
     <description>
         This bundle porvides a Cache API for Sling applications to use.
     </description>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.