After my recent discovery of Hazelcast, I decided to update my caching aspect project to include a Hazelcast implementation.
The source code for this project is available here
For more information please refer to the actual source or my original Ehcache post. The main difference here is that the Hazelcast implementation is by default a distributed cache, and takes advantage of all the other functionality that Hazelcast provides.
The main points of interest for this implementation are:
- The actual aspect class. See code below.
- The application context. See xml below.
- The Hazelcast configuration. I am using the default Hazelcast configuration, located in the hazelcast-version.jar. To use a custom one, you can define a hazelcast.xml and inject it via Spring.
- The CacheKeyStrategy in the code below is an interface defined to allow key generation for the cache for specific requirements. There is a default implementation that simply sorts and uses hashcodes of the values in the class. You can define a strategy per type you want to cache.
note: java docs only removed for size of post
The aspect:
The application context:
The test case:
Subscribe to:
Post Comments (Atom)
Popular Posts
-
I have recently been slacking on content on my blog, between long stressful hours at work and to the wonderful toy that is an iPhone, I have...
-
I make no claim to be a "computer scientist" or a software "engineer", those titles alone can spark some debate, I regar...
-
I saw an article (well more of a rant) the other day, by Rob Williams Brain Drain in enterprise Dev . I have to say, I do agree with some o...
-
This series of posts will be about me getting to grips with JBoss Drools . The reasoning behind it is: SAP bought out my company's curre...
-
Update: Check out my updated re-certification on the new 2019 exam... here Let me start by saying, for this certification I studied and...
Any idea how this can be done using Guice?
ReplyDeleteHi, Guice require source-level access. If the annotation bothers you or you're using Guice to create objects. I found another advance tutorial here, you can see, http://beust.com/weblog/2012/08/21/advanced-dependency-injection-with-guice/
DeleteHowever I love this post also, really appreciate your work. Thanks from dragonflygames.co.uk -best free ios games
Mmmm... I have never used Guice, just did a quick search and a little bit of reading... I could probably slap it together tomorrow. From what I can see Guice is also using AopAlliance.. and their implementation will be very similar to my original Spring 2.x or even 1.X implementation. You will need to Implement MethodInterceptor ... and use a MethodInvocation object instead of ProceedingJoinPoint.
ReplyDeleteIf you don't come right, let me know.. shouldn't take long to adapt this version.
Gr8 article. Thx for sharing. I linked up your article from my blog. Hope you do not mind :)... Cheers.
ReplyDeleteDinuka
Thank you... and of course I don't mind.
ReplyDeleteMua vé tại Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ tháng nào rẻ nhất
vé máy bay từ mỹ về việt nam hãng korea
giá vé máy bay từ Toronto đến việt nam
bán vé máy bay từ nhật về việt nam
Giá vé máy bay Hàn Việt Vietjet
Vé máy bay từ Đài Loan về VN
Chi phí cho chuyên gia nước ngoài