11/**
2- * MemCached client for Java
2+ * Memcached client for Java
33 * Copyright (c) 2008 Greg Whalin
44 * All rights reserved.
55 *
1717 * @author Greg Whalin <[email protected] > 1818 * @version 2.0
1919 */
20- package com .danga . MemCached ;
20+ package com .whalin . memcached ;
2121
2222import java .util .*;
2323import java .util .zip .*;
4545 * Some examples of use follow.<br/>
4646 * <h3>To create cache client object and set params:</h3>
4747 * <pre>
48- * MemCachedClient mc = new MemCachedClient ();
48+ * MemcachedClient mc = new MemcachedClient ();
4949 *
5050 * // compression is enabled by default
5151 * mc.setCompressEnable(true);
5959 * </pre>
6060 * <h3>To store an object:</h3>
6161 * <pre>
62- * MemCachedClient mc = new MemCachedClient ();
62+ * MemcachedClient mc = new MemcachedClient ();
6363 * String key = "cacheKey1";
6464 * Object value = SomeClass.getObject();
6565 * mc.set(key, value);
6666 * </pre>
6767 * <h3>To store an object using a custom server hashCode:</h3>
6868 * <pre>
69- * MemCachedClient mc = new MemCachedClient ();
69+ * MemcachedClient mc = new MemcachedClient ();
7070 * String key = "cacheKey1";
7171 * Object value = SomeClass.getObject();
7272 * Integer hash = new Integer(45);
8080 * </ul>
8181 * <h3>To delete a cache entry:</h3>
8282 * <pre>
83- * MemCachedClient mc = new MemCachedClient ();
83+ * MemcachedClient mc = new MemcachedClient ();
8484 * String key = "cacheKey1";
8585 * mc.delete(key);
8686 * </pre>
8787 * <h3>To delete a cache entry using a custom hash code:</h3>
8888 * <pre>
89- * MemCachedClient mc = new MemCachedClient ();
89+ * MemcachedClient mc = new MemcachedClient ();
9090 * String key = "cacheKey1";
9191 * Integer hash = new Integer(45);
9292 * mc.delete(key, hashCode);
9393 * </pre>
9494 * <h3>To store a counter and then increment or decrement that counter:</h3>
9595 * <pre>
96- * MemCachedClient mc = new MemCachedClient ();
96+ * MemcachedClient mc = new MemcachedClient ();
9797 * String key = "counterKey";
9898 * mc.storeCounter(key, new Integer(100));
9999 * System.out.println("counter after adding 1: " mc.incr(key));
103103 * </pre>
104104 * <h3>To store a counter and then increment or decrement that counter with custom hash:</h3>
105105 * <pre>
106- * MemCachedClient mc = new MemCachedClient ();
106+ * MemcachedClient mc = new MemcachedClient ();
107107 * String key = "counterKey";
108108 * Integer hash = new Integer(45);
109109 * mc.storeCounter(key, new Integer(100), hash);
114114 * </pre>
115115 * <h3>To retrieve an object from the cache:</h3>
116116 * <pre>
117- * MemCachedClient mc = new MemCachedClient ();
117+ * MemcachedClient mc = new MemcachedClient ();
118118 * String key = "key";
119119 * Object value = mc.get(key);
120120 * </pre>
121121 * <h3>To retrieve an object from the cache with custom hash:</h3>
122122 * <pre>
123- * MemCachedClient mc = new MemCachedClient ();
123+ * MemcachedClient mc = new MemcachedClient ();
124124 * String key = "key";
125125 * Integer hash = new Integer(45);
126126 * Object value = mc.get(key, hash);
127127 * </pre>
128128 * <h3>To retrieve an multiple objects from the cache</h3>
129129 * <pre>
130- * MemCachedClient mc = new MemCachedClient ();
130+ * MemcachedClient mc = new MemcachedClient ();
131131 * String[] keys = { "key", "key1", "key2" };
132132 * Map<Object> values = mc.getMulti(keys);
133133 * </pre>
134134 * <h3>To retrieve an multiple objects from the cache with custom hashing</h3>
135135 * <pre>
136- * MemCachedClient mc = new MemCachedClient ();
136+ * MemcachedClient mc = new MemcachedClient ();
137137 * String[] keys = { "key", "key1", "key2" };
138138 * Integer[] hashes = { new Integer(45), new Integer(32), new Integer(44) };
139139 * Map<Object> values = mc.getMulti(keys, hashes);
140140 * </pre>
141141 * <h3>To flush all items in server(s)</h3>
142142 * <pre>
143- * MemCachedClient mc = new MemCachedClient ();
143+ * MemcachedClient mc = new MemcachedClient ();
144144 * mc.flushAll();
145145 * </pre>
146146 * <h3>To get stats from server(s)</h3>
147147 * <pre>
148- * MemCachedClient mc = new MemCachedClient ();
148+ * MemcachedClient mc = new MemcachedClient ();
149149 * Map stats = mc.stats();
150150 * </pre>
151151 *
156156 * @author Vin Chawla <[email protected] > 157157 * @version 1.5
158158 */
159- public class MemCachedClient {
159+ public class MemcachedClient {
160160
161161 // logger
162162 private static Logger log =
@@ -224,7 +224,7 @@ public class MemCachedClient {
224224 /**
225225 * Creates a new instance of MemCachedClient.
226226 */
227- public MemCachedClient () {
227+ public MemcachedClient () {
228228 init ();
229229 }
230230
@@ -234,7 +234,7 @@ public MemCachedClient() {
234234 *
235235 * @param poolName name of SockIOPool
236236 */
237- public MemCachedClient ( String poolName ) {
237+ public MemcachedClient ( String poolName ) {
238238 this .poolName = poolName ;
239239 init ();
240240 }
@@ -245,7 +245,7 @@ public MemCachedClient( String poolName ) {
245245 *
246246 * @param classLoader ClassLoader object.
247247 */
248- public MemCachedClient ( ClassLoader classLoader ) {
248+ public MemcachedClient ( ClassLoader classLoader ) {
249249 this .classLoader = classLoader ;
250250 init ();
251251 }
@@ -258,7 +258,7 @@ public MemCachedClient( ClassLoader classLoader ) {
258258 * @param classLoader ClassLoader object.
259259 * @param errorHandler ErrorHandler object.
260260 */
261- public MemCachedClient ( ClassLoader classLoader , ErrorHandler errorHandler ) {
261+ public MemcachedClient ( ClassLoader classLoader , ErrorHandler errorHandler ) {
262262 this .classLoader = classLoader ;
263263 this .errorHandler = errorHandler ;
264264 init ();
@@ -273,7 +273,7 @@ public MemCachedClient( ClassLoader classLoader, ErrorHandler errorHandler ) {
273273 * @param errorHandler ErrorHandler object.
274274 * @param poolName SockIOPool name
275275 */
276- public MemCachedClient ( ClassLoader classLoader , ErrorHandler errorHandler , String poolName ) {
276+ public MemcachedClient ( ClassLoader classLoader , ErrorHandler errorHandler , String poolName ) {
277277 this .classLoader = classLoader ;
278278 this .errorHandler = errorHandler ;
279279 this .poolName = poolName ;
@@ -2041,10 +2041,10 @@ else if ( line.startsWith( ERROR ) || line.startsWith( CLIENT_ERROR ) || line.st
20412041 protected final class NIOLoader {
20422042 protected Selector selector ;
20432043 protected int numConns = 0 ;
2044- protected MemCachedClient mc ;
2044+ protected MemcachedClient mc ;
20452045 protected Connection [] conns ;
20462046
2047- public NIOLoader ( MemCachedClient mc ) {
2047+ public NIOLoader ( MemcachedClient mc ) {
20482048 this .mc = mc ;
20492049 }
20502050
@@ -2232,7 +2232,7 @@ public void doMulti( boolean asString, Map<String, StringBuilder> sockKeys, Stri
22322232 private void handleError ( Throwable e , String [] keys ) {
22332233 // if we have an errorHandler, use its hook
22342234 if ( errorHandler != null )
2235- errorHandler .handleErrorOnGet ( MemCachedClient .this , e , keys );
2235+ errorHandler .handleErrorOnGet ( MemcachedClient .this , e , keys );
22362236
22372237 // exception thrown
22382238 log .error ( "++++ exception thrown while getting from cache on getMulti" );
0 commit comments