11/**
2- * Copyright 2012-2018 the original author or authors.
2+ * Copyright 2012-2019 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -70,6 +70,21 @@ final class MemcachedConfiguration {
7070 */
7171 private TimeUnit timeUnit ;
7272
73+ /**
74+ * The flag to enable SASL Connection
75+ */
76+ private boolean usingSASL ;
77+
78+ /**
79+ * The Memcached SASL username
80+ */
81+ private String username ;
82+
83+ /**
84+ * The Memcached SASL password
85+ */
86+ private String password ;
87+
7388 /**
7489 * @return the keyPrefix
7590 */
@@ -190,13 +205,58 @@ public void setTimeUnit(TimeUnit timeUnit) {
190205 this .timeUnit = timeUnit ;
191206 }
192207
208+ /**
209+ * @return the usingSASL
210+ */
211+ public boolean isUsingSASL () {
212+ return usingSASL ;
213+ }
214+
215+ /**
216+ * @param usingSASL
217+ * the usingSASL to set
218+ */
219+ public void setUsingSASL (boolean usingSASL ) {
220+ this .usingSASL = usingSASL ;
221+ }
222+
223+ /**
224+ * @return the username
225+ */
226+ public String getUsername () {
227+ return username ;
228+ }
229+
230+ /**
231+ * @param username
232+ * the username to set
233+ */
234+ public void setUsername (String username ) {
235+ this .username = username ;
236+ }
237+
238+ /**
239+ * @return the password
240+ */
241+ public String getPassword () {
242+ return password ;
243+ }
244+
245+ /**
246+ * @param password
247+ * the password to set
248+ */
249+ public void setPassword (String password ) {
250+ this .password = password ;
251+ }
252+
193253 /**
194254 * {@inheritDoc}
195255 */
196256 @ Override
197257 public int hashCode () {
198258 return hash (1 , 31 , addresses , compressionEnabled , connectionFactory , expiration , keyPrefix , timeUnit , timeout ,
199- usingAsyncGet );
259+ usingAsyncGet , usingSASL , username , password );
200260 }
201261
202262 /**
@@ -234,7 +294,8 @@ public boolean equals(Object obj) {
234294 return eq (addresses , other .addresses ) && eq (compressionEnabled , other .compressionEnabled )
235295 && eq (connectionFactory , other .connectionFactory ) && eq (expiration , other .expiration )
236296 && eq (keyPrefix , other .keyPrefix ) && eq (timeUnit , other .timeUnit ) && eq (timeout , other .timeout )
237- && eq (usingAsyncGet , other .usingAsyncGet );
297+ && eq (usingAsyncGet , other .usingAsyncGet ) && eq (usingSASL , other .usingSASL ) && eq (username , other .username )
298+ && eq (password , other .password );
238299 }
239300
240301 /**
@@ -256,8 +317,9 @@ private static <O> boolean eq(O o1, O o2) {
256317 @ Override
257318 public String toString () {
258319 return format (
259- "MemcachedConfiguration [addresses=%s, compressionEnabled=%s, connectionFactory=%s, , expiration=%s, keyPrefix=%s, timeUnit=%s, timeout=%s, usingAsyncGet=%s]" ,
260- addresses , compressionEnabled , connectionFactory , expiration , keyPrefix , timeUnit , timeout , usingAsyncGet );
320+ "MemcachedConfiguration [addresses=%s, compressionEnabled=%s, connectionFactory=%s, , expiration=%s, keyPrefix=%s, timeUnit=%s, timeout=%s, usingAsyncGet=%s, usingSASL=%s, username=%s, password=%s]" ,
321+ addresses , compressionEnabled , connectionFactory , expiration , keyPrefix , timeUnit , timeout , usingAsyncGet ,
322+ usingSASL , username , password );
261323 }
262324
263325}
0 commit comments