@@ -108,24 +108,28 @@ private String dogpileTokenKey(String objectKey) {
108108 private Object memcacheGet (Object key ) {
109109 String objectKey = toKey (key );
110110
111- Map <String , Object > multi ;
112-
113111 if (dogpilePreventionEnabled ) {
114- String dogpileKey = dogpileTokenKey (objectKey );
115- log .debug ("Checking dogpile key: [{}]" , dogpileKey );
116-
117- log .debug ("Memcache.getMulti({}, {})" , objectKey , dogpileKey );
118- multi = memcache .getMulti (dogpileKey , objectKey );
112+ return getUsingDogpilePrevention (objectKey );
119113
120- if (multi .get (dogpileKey ) == null ) {
121- log .debug ("Dogpile key ({}) not found updating token and returning null" , dogpileKey );
122- memcache .set (dogpileKey , cacheTimeSeconds , DOGPILE_TOKEN );
123- return null ;
124- }
125- log .debug ("Dogpile token found for key ({}), getting cached object" , dogpileKey );
126114 } else {
127115 log .debug ("Memcache.get({})" , objectKey );
128- multi = memcache .getMulti (objectKey );
116+ return memcache .get (objectKey );
117+ }
118+ }
119+
120+ private Object getUsingDogpilePrevention (String objectKey ) {
121+ Map <String , Object > multi ;
122+
123+ String dogpileKey = dogpileTokenKey (objectKey );
124+ log .debug ("Checking dogpile key: [{}]" , dogpileKey );
125+
126+ log .debug ("Memcache.getMulti({}, {})" , objectKey , dogpileKey );
127+ multi = memcache .getMulti (dogpileKey , objectKey );
128+
129+ if ((multi == null ) || (multi .get (dogpileKey ) == null )) {
130+ log .debug ("Dogpile key ({}) not found updating token and returning null" , dogpileKey );
131+ memcache .set (dogpileKey , cacheTimeSeconds , DOGPILE_TOKEN );
132+ return null ;
129133 }
130134
131135 return multi .get (objectKey );
0 commit comments