1 /* 2 * ==================================================================== 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * ==================================================================== 20 * 21 * This software consists of voluntary contributions made by many 22 * individuals on behalf of the Apache Software Foundation. For more 23 * information on the Apache Software Foundation, please see 24 * <http://www.apache.org/>. 25 * 26 */ 27 /* 28 * ==================================================================== 29 * Licensed to the Apache Software Foundation (ASF) under one 30 * or more contributor license agreements. See the NOTICE file 31 * distributed with this work for additional information 32 * regarding copyright ownership. The ASF licenses this file 33 * to you under the Apache License, Version 2.0 (the 34 * "License"); you may not use this file except in compliance 35 * with the License. You may obtain a copy of the License at 36 * 37 * http://www.apache.org/licenses/LICENSE-2.0 38 * 39 * Unless required by applicable law or agreed to in writing, 40 * software distributed under the License is distributed on an 41 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 42 * KIND, either express or implied. See the License for the 43 * specific language governing permissions and limitations 44 * under the License. 45 * ==================================================================== 46 * 47 * This software consists of voluntary contributions made by many 48 * individuals on behalf of the Apache Software Foundation. For more 49 * information on the Apache Software Foundation, please see 50 * <http://www.apache.org/>. 51 * 52 */package org.apache.hc.client5.http.impl.cache.memcached; 53 54 /** 55 * Since the {@link org.apache.hc.client5.http.cache.HttpCacheStorage} interface 56 * expects to use variant-annotated URLs for its storage keys, but Memcached 57 * has a maximum key size, we need to support mapping storage keys to cache 58 * keys. Clients can implement this interface to change the way the mapping 59 * is done (for example, to add a prefix to all cache keys to provide a form 60 * of memcached namespacing). 61 * 62 * @since 4.1 63 */ 64 public interface KeyHashingScheme { 65 66 /** Maps a storage key to a cache key. The storage key is what 67 * the higher-level HTTP cache uses as a key; the cache key is what 68 * we use as a key for talking to memcached. 69 * @param storageKey what the higher-level HTTP cache wants to use 70 * as its key for looking up cache entries 71 * @return a cache key suitable for use with memcached 72 */ 73 String hash(String storageKey); 74 }