블로그 이미지
권남

카테고리

분류 전체보기 (227)
Temp (1)
CA (0)
Game (0)
nGrinder (0)
Java (17)
JavaScript (1)
JBOSS (0)
EJBCA (0)
Tomcat (1)
DB (6)
Cache (6)
LINUX (4)
Frameworks (11)
C++ (32)
C (96)
Mosquitto (3)
STB (0)
JNI (10)
Android (5)
WebSocket (1)
PDF (0)
AVR (13)
LINUX Device Driver (8)
Arduino (4)
ekgu (0)
resume, portfolio (1)
Dynamics AX (X++) (4)
comp (0)
Total
Today
Yesterday

달력

« » 2025.2
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28

공지사항

최근에 올라온 글

Ehcache

Cache/Ehcache / 2015. 10. 28. 10:47

Ehcache 2.10 - doc
http://www.ehcache.org/generated/2.10.0/html/ehc-all/#page/Ehcache_Documentation_Set%2Fto-ehcache_online_documentation_library.html%23


Hashtable -> Ehcache

private static Hashtable<String, ControlMemory> hashManager = new Hashtable<String, ControlMemory>();
private static Hashtable<String, String> hashSTBManager = new Hashtable<String, String>();
private static Hashtable<String, String> hashMappingManager = new Hashtable<String, String>();


Basic Caching Problem

- Bad Code Readablity
- Hashtable to Ehcache Method problem.
    [Deffernce]
    Hashtable<K, V>
        get(K)
        put(K,V)
        getKeys() - return Enumeration - hasMoreElements(), nextElement()
        containsKey(String), containsValue(String)
    Ehcache<K, V>
        get(K) - return Object. So needgetObjectValue() or getObjectKey()
        put(new Elemnet(K,V))
        getKeys() - return List - iterator().hasNext(), iterator().next()
        isKeyInCache(String), isValueInCache(String)
- Proto type of EhcacheManager class : Occuered NullPointerException when used [getCache, get, put, etc .. ] in other class


Solution
- Use Wrapper class
    EhcacheWrapper<K, V> implements CacheWrapper<K, V>


How to use in other class

CacheManager cacheManager =  CacheManager.newInstance();

EhcacheWrapper<String, ControlMemory> hashManager = new EhcacheWrapper<String, ControlMemory>("hashManager", cacheManager);
EhcacheWrapper<String, String> hashSTBManager = new EhcacheWrapper<String, String>("hashSTBManager", cacheManager);
EhcacheWrapper<String, String> hashMappingManager = new EhcacheWrapper<String, String>("hashMappingManager", cacheManager);
......

Use Same to Hashtable. Likes hashManager.get() / put / containsKey, Value / keys / remove / etc....


'Cache > Ehcache' 카테고리의 다른 글

Expired Element Eviction Timing  (0) 2015.12.02
ehcache does not remove Element from memory on eviction  (0) 2015.11.26
Eviction, Expiration  (0) 2015.11.24
Using CacheManager  (0) 2015.11.24
Gettimg expired cache  (0) 2015.11.24
Posted by 권남
, |

최근에 달린 댓글

글 보관함