Showing
3 changed files
with
4 additions
and
9 deletions
@@ -6,8 +6,6 @@ import java.util.Map; | @@ -6,8 +6,6 @@ import java.util.Map; | ||
6 | 6 | ||
7 | import javax.annotation.PostConstruct; | 7 | import javax.annotation.PostConstruct; |
8 | 8 | ||
9 | -import org.slf4j.Logger; | ||
10 | -import org.slf4j.LoggerFactory; | ||
11 | import org.springframework.stereotype.Service; | 9 | import org.springframework.stereotype.Service; |
12 | 10 | ||
13 | import com.yoho.search.cache.impl.EhCacheImpl; | 11 | import com.yoho.search.cache.impl.EhCacheImpl; |
@@ -20,8 +18,6 @@ import com.yoho.search.utils.TimeUtils; | @@ -20,8 +18,6 @@ import com.yoho.search.utils.TimeUtils; | ||
20 | @Service | 18 | @Service |
21 | public class CacheService { | 19 | public class CacheService { |
22 | 20 | ||
23 | - private final Logger logger = LoggerFactory.getLogger(CacheService.class); | ||
24 | - | ||
25 | public CacheInterface cacheInterface; | 21 | public CacheInterface cacheInterface; |
26 | 22 | ||
27 | /** | 23 | /** |
@@ -29,7 +25,6 @@ public class CacheService { | @@ -29,7 +25,6 @@ public class CacheService { | ||
29 | */ | 25 | */ |
30 | @PostConstruct | 26 | @PostConstruct |
31 | public void init() { | 27 | public void init() { |
32 | - logger.info("使用 本地缓存"); | ||
33 | cacheInterface = EhCacheImpl.getInstance(); | 28 | cacheInterface = EhCacheImpl.getInstance(); |
34 | } | 29 | } |
35 | 30 |
@@ -103,6 +103,7 @@ public class EhCacheImpl implements CacheInterface { | @@ -103,6 +103,7 @@ public class EhCacheImpl implements CacheInterface { | ||
103 | add(key, value, expiration); | 103 | add(key, value, expiration); |
104 | return true; | 104 | return true; |
105 | } catch (Exception e) { | 105 | } catch (Exception e) { |
106 | + logger.error(e.getMessage(),e); | ||
106 | return false; | 107 | return false; |
107 | } | 108 | } |
108 | } | 109 | } |
@@ -112,7 +113,7 @@ public class EhCacheImpl implements CacheInterface { | @@ -112,7 +113,7 @@ public class EhCacheImpl implements CacheInterface { | ||
112 | delete(key); | 113 | delete(key); |
113 | return true; | 114 | return true; |
114 | } catch (Exception e) { | 115 | } catch (Exception e) { |
115 | - logger.error(e.toString()); | 116 | + logger.error(e.getMessage(),e); |
116 | return false; | 117 | return false; |
117 | } | 118 | } |
118 | } | 119 | } |
@@ -122,7 +123,7 @@ public class EhCacheImpl implements CacheInterface { | @@ -122,7 +123,7 @@ public class EhCacheImpl implements CacheInterface { | ||
122 | replace(key, value, expiration); | 123 | replace(key, value, expiration); |
123 | return true; | 124 | return true; |
124 | } catch (Exception e) { | 125 | } catch (Exception e) { |
125 | - logger.error(e.toString()); | 126 | + logger.error(e.getMessage(),e); |
126 | return false; | 127 | return false; |
127 | } | 128 | } |
128 | } | 129 | } |
@@ -132,7 +133,7 @@ public class EhCacheImpl implements CacheInterface { | @@ -132,7 +133,7 @@ public class EhCacheImpl implements CacheInterface { | ||
132 | set(key, value, expiration); | 133 | set(key, value, expiration); |
133 | return true; | 134 | return true; |
134 | } catch (Exception e) { | 135 | } catch (Exception e) { |
135 | - logger.error(e.toString()); | 136 | + logger.error(e.getMessage(),e); |
136 | return false; | 137 | return false; |
137 | } | 138 | } |
138 | } | 139 | } |
@@ -23,7 +23,6 @@ public class CacheObject implements Serializable{ | @@ -23,7 +23,6 @@ public class CacheObject implements Serializable{ | ||
23 | return expireTime; | 23 | return expireTime; |
24 | } | 24 | } |
25 | 25 | ||
26 | - | ||
27 | public static void main(String[] args) { | 26 | public static void main(String[] args) { |
28 | long current = System.currentTimeMillis(); | 27 | long current = System.currentTimeMillis(); |
29 | System.out.println(current); | 28 | System.out.println(current); |
-
Please register or login to post a comment