|
18 | 18 | */ |
19 | 19 | package org.b3log.symphony.processor; |
20 | 20 |
|
21 | | -import com.github.benmanes.caffeine.cache.Cache; |
22 | | -import com.github.benmanes.caffeine.cache.Caffeine; |
23 | 21 | import com.qiniu.cdn.CdnManager; |
24 | 22 | import com.qiniu.cdn.CdnResult; |
25 | | -import com.qiniu.storage.BucketManager; |
26 | | -import com.qiniu.storage.Configuration; |
27 | | -import com.qiniu.storage.Region; |
28 | 23 | import com.qiniu.util.Auth; |
29 | 24 | import org.apache.commons.lang.RandomStringUtils; |
30 | 25 | import org.apache.commons.lang.StringUtils; |
|
43 | 38 | import org.b3log.latke.repository.FilterOperator; |
44 | 39 | import org.b3log.latke.repository.PropertyFilter; |
45 | 40 | import org.b3log.latke.repository.Query; |
46 | | -import org.b3log.latke.repository.RepositoryException; |
47 | 41 | import org.b3log.latke.service.LangPropsService; |
48 | 42 | import org.b3log.latke.service.ServiceException; |
49 | 43 | import org.b3log.latke.util.Crypts; |
@@ -267,22 +261,10 @@ public void callbackFromQiNiu(final RequestContext context) { |
267 | 261 | * @return userInfo |
268 | 262 | * @throws NullPointerException if apiKey is null or not found in keymaps |
269 | 263 | */ |
270 | | - private static final Cache<String, JSONObject> apiKeyUserCache = Caffeine.newBuilder() |
271 | | - .expireAfterWrite(60, java.util.concurrent.TimeUnit.MINUTES) |
272 | | - .maximumSize(10000) |
273 | | - .build(); |
274 | | - |
275 | 264 | public static JSONObject getUserByKey(String apiKey) { |
276 | 265 | if (apiKey != null && apiKey.length() == 192) { |
277 | | - // 先查缓存 |
278 | | - JSONObject user = apiKeyUserCache.getIfPresent(apiKey); |
279 | | - if (user != null) { |
280 | | - return user; |
281 | | - } |
282 | | - // 缓存没有,解密+查库 |
283 | | - user = tryLogInWithApiKey(apiKey); |
284 | | - if (user != null) { |
285 | | - apiKeyUserCache.put(apiKey, user); |
| 266 | + JSONObject user = tryLogInWithApiKey(apiKey); |
| 267 | + if (null != user) { |
286 | 268 | return user; |
287 | 269 | } |
288 | 270 | } |
|
0 commit comments