You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2022/02/11 17:09:07 UTC

[httpcomponents-client] branch master updated (b56dedf -> b9a6b5e)

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

olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.


 discard b56dedf  HTTPCLIENT-2202: MemcachedHttpCacheStorage should use MemcachedClientIF interface instead of MemcachedClient
     new b9a6b5e  HTTPCLIENT-2202: MemcachedHttpCacheStorage to support MemcachedClientIF interface

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b56dedf)
            \
             N -- N -- N   refs/heads/master (b9a6b5e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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.


Summary of changes:
 .../cache/memcached/MemcachedHttpCacheStorage.java | 29 ++++++++--------------
 1 file changed, 11 insertions(+), 18 deletions(-)

[httpcomponents-client] 01/01: HTTPCLIENT-2202: MemcachedHttpCacheStorage to support MemcachedClientIF interface

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

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit b9a6b5ed897c0a4cafc52d96dd88c6eceac3797f
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Feb 10 20:33:05 2022 +0100

    HTTPCLIENT-2202: MemcachedHttpCacheStorage to support MemcachedClientIF interface
---
 .../cache/memcached/MemcachedHttpCacheStorage.java | 35 +++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedHttpCacheStorage.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedHttpCacheStorage.java
index dc40e89..a8ff8ff 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedHttpCacheStorage.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/memcached/MemcachedHttpCacheStorage.java
@@ -42,6 +42,7 @@ import org.apache.hc.core5.util.Args;
 import net.spy.memcached.CASResponse;
 import net.spy.memcached.CASValue;
 import net.spy.memcached.MemcachedClient;
+import net.spy.memcached.MemcachedClientIF;
 import net.spy.memcached.OperationTimeoutException;
 
 /**
@@ -84,7 +85,7 @@ import net.spy.memcached.OperationTimeoutException;
  */
 public class MemcachedHttpCacheStorage extends AbstractBinaryCacheStorage<CASValue<Object>> {
 
-    private final MemcachedClient client;
+    private final MemcachedClientIF client;
     private final KeyHashingScheme keyHashingScheme;
 
     /**
@@ -109,6 +110,18 @@ public class MemcachedHttpCacheStorage extends AbstractBinaryCacheStorage<CASVal
     }
 
     /**
+     * Create a storage backend using the pre-configured given
+     * <i>memcached</i> client.
+     *
+     * @param cache client to use for communicating with <i>memcached</i>
+     *
+     * @since 5.2
+     */
+    public MemcachedHttpCacheStorage(final MemcachedClientIF cache) {
+        this(cache, CacheConfig.DEFAULT, ByteArrayCacheEntrySerializer.INSTANCE, SHA256KeyHashingScheme.INSTANCE);
+    }
+
+    /**
      * Create a storage backend using the given <i>memcached</i> client and
      * applying the given cache configuration, serialization, and hashing
      * mechanisms.
@@ -123,6 +136,26 @@ public class MemcachedHttpCacheStorage extends AbstractBinaryCacheStorage<CASVal
             final CacheConfig config,
             final HttpCacheEntrySerializer<byte[]> serializer,
             final KeyHashingScheme keyHashingScheme) {
+        this((MemcachedClientIF) client, config, serializer, keyHashingScheme);
+    }
+
+    /**
+     * Create a storage backend using the given <i>memcached</i> client and
+     * applying the given cache configuration, serialization, and hashing
+     * mechanisms.
+     *
+     * @param client           how to talk to <i>memcached</i>
+     * @param config           apply HTTP cache-related options
+     * @param serializer       alternative serialization mechanism
+     * @param keyHashingScheme how to map higher-level logical "storage keys"
+     *                         onto "cache keys" suitable for use with memcached
+     * @since 5.2
+     */
+    public MemcachedHttpCacheStorage(
+            final MemcachedClientIF client,
+            final CacheConfig config,
+            final HttpCacheEntrySerializer<byte[]> serializer,
+            final KeyHashingScheme keyHashingScheme) {
         super((config != null ? config : CacheConfig.DEFAULT).getMaxUpdateRetries(),
                 serializer != null ? serializer : ByteArrayCacheEntrySerializer.INSTANCE);
         this.client = Args.notNull(client, "Memcached client");