| Line 22... |
Line 22... |
| 22 |
EhcacheWrapper.PRODUCT_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
22 |
EhcacheWrapper.PRODUCT_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
| 23 |
private static EhcacheWrapper<String, Object> showcasePageSnippetsCache = new EhcacheWrapper<String, Object>(
|
23 |
private static EhcacheWrapper<String, Object> showcasePageSnippetsCache = new EhcacheWrapper<String, Object>(
|
| 24 |
EhcacheWrapper.SHOWCASE_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
24 |
EhcacheWrapper.SHOWCASE_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
| 25 |
private static EhcacheWrapper<String, List<String>> homeSnippetCache = new EhcacheWrapper<String, List<String>>(
|
25 |
private static EhcacheWrapper<String, List<String>> homeSnippetCache = new EhcacheWrapper<String, List<String>>(
|
| 26 |
EhcacheWrapper.HOME_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
26 |
EhcacheWrapper.HOME_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
|
| - |
|
27 |
private static EhcacheWrapper<String, String> privateDalSnippetCache = new EhcacheWrapper<String, String>(
|
| - |
|
28 |
EhcacheWrapper.PRIVATE_DEAL_SNIPPET, CacheManager.create());
|
| 27 |
|
29 |
|
| 28 |
public static Object getSnippet(CacheKeys cacheType, String docId, long sourceId){
|
30 |
public static Object getSnippet(CacheKeys cacheType, String docId, long sourceId){
|
| 29 |
|
31 |
|
| 30 |
switch (cacheType) {
|
32 |
switch (cacheType) {
|
| 31 |
case HOME_PAGE_SNIPPET_CACHE_KEY:
|
33 |
case HOME_PAGE_SNIPPET_CACHE_KEY:
|
| Line 36... |
Line 38... |
| 36 |
return getProductSnippet(docId, sourceId);
|
38 |
return getProductSnippet(docId, sourceId);
|
| 37 |
case CATEGORY_SNIPPET_CACHE_KEY:
|
39 |
case CATEGORY_SNIPPET_CACHE_KEY:
|
| 38 |
return getCategorySnippet(docId, sourceId);
|
40 |
return getCategorySnippet(docId, sourceId);
|
| 39 |
case SEARCH_SNIPPET_CACHE_KEY:
|
41 |
case SEARCH_SNIPPET_CACHE_KEY:
|
| 40 |
return getSearchSnippet(docId, sourceId);
|
42 |
return getSearchSnippet(docId, sourceId);
|
| - |
|
43 |
case PRIVATE_DEAL_SNIPPET_KEY:
|
| - |
|
44 |
return getPrivateDealSnippet(docId, sourceId);
|
| - |
|
45 |
|
| - |
|
46 |
|
| 41 |
|
47 |
|
| 42 |
default:
|
48 |
default:
|
| 43 |
break;
|
49 |
break;
|
| 44 |
}
|
50 |
}
|
| 45 |
|
51 |
|
| Line 57... |
Line 63... |
| 57 |
else {
|
63 |
else {
|
| 58 |
log.info("Loading search snippet from cache : " + docId);
|
64 |
log.info("Loading search snippet from cache : " + docId);
|
| 59 |
}
|
65 |
}
|
| 60 |
return snippet;
|
66 |
return snippet;
|
| 61 |
}
|
67 |
}
|
| - |
|
68 |
|
| - |
|
69 |
private static String getPrivateDealSnippet(String docId, long sourceId) {
|
| - |
|
70 |
String snippet = privateDalSnippetCache.get(docId);
|
| - |
|
71 |
if (snippet == null) {
|
| - |
|
72 |
snippet = ContentServingService.getSnippet(SnippetType.PRIVATE_DEAL_SNIPPET, docId, sourceId);
|
| - |
|
73 |
if (sourceId == -1 && snippet != null) {
|
| - |
|
74 |
privateDalSnippetCache.put(docId, snippet);
|
| - |
|
75 |
}
|
| - |
|
76 |
}
|
| - |
|
77 |
else {
|
| - |
|
78 |
log.info("Loading search snippet from cache : " + docId);
|
| - |
|
79 |
}
|
| - |
|
80 |
return snippet;
|
| - |
|
81 |
}
|
| 62 |
|
82 |
|
| 63 |
private static String getCategorySnippet(String docId, long sourceId)
|
83 |
private static String getCategorySnippet(String docId, long sourceId)
|
| 64 |
{
|
84 |
{
|
| 65 |
String snippet = categorySnippetCache.get(docId);
|
85 |
String snippet = categorySnippetCache.get(docId);
|
| 66 |
if (snippet == null) {
|
86 |
if (snippet == null) {
|