
By Thomas Krafft | Article Rating: |
|
June 21, 2012 07:45 PM EDT | Reads: |
323 |

Recently, at one of the customer meetings, I was asked whether GridGain comes with its own database. Naturally my reaction was – why? GridGain easily integrates pretty much with any persistent store you wish, including any RDBMS, NoSql, or HDFS stores. However, then I thought, why not? We already have cache swap space (disk overflow) storage based on Google LevelDB key-value database implementation, so why not have the same for data store.
Here is how easy it was to add LevelDB based data store implementation for GridGain cache – literally took me 20 minutes to do, including unit tests. The store is based on GridGain swap space, but since swap space is based on LevelDB, you essentially get LevelDB local store for your cached data.
public class GridCacheSwapSpaceStore<K, V> extends GridCacheStoreAdapter<K, V> { private ClassLoader dfltLdr = getClass().getClassLoader(); @GridInstanceResource private Grid g; // Auto-injected grid instance @Override public V load(String cacheName, GridCacheTx tx, K key) throws GridException { return g.readFromSwap(spaceName(cacheName), key, classLoader(key)); } @Override public void put(String cacheName, GridCacheTx tx, K key, V val) throws GridException { g.writeToSwap(spaceName(cacheName), key, val, classLoader(val, key)); } @Override public void remove(String cacheName, GridCacheTx tx, K key) throws GridException { g.removeFromSwap(spaceName(cacheName), key, null, classLoader(key)); } private String spaceName(String cacheName) { return cacheName == null ? "gg-st-default" : "gg-st-" + cacheName; } private ClassLoader classLoader(Object... objs) { ClassLoader ldr = null; for (Object o : objs) { if (o != null) { ldr = U.detectClassLoader(o.getClass()); if (ldr != dfltLdr) break; } } return ldr; } }
Quite easily done in my view. Plenty of more examples of different GridGain cache store implementations can be found on GitHub here.
Read the original blog entry...
Published June 21, 2012 Reads 323
Copyright © 2012 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Thomas Krafft
Thomas Krafft heads marketing and communication efforts for GridGain Systems, makers of leading in-memory solutions used by customers to make their big data faster. He brings over 15 years of experience, helping companies connect with their customers, and driving highly successful efforts for Fortune companies including Intuit and Veritas, internet startups (both acquired), and hundreds of clients he served through his own consulting firms, including NASA and The Internet Archives. Thomas has spent the past several years working within the emerging NOSQL (“Not Only SQL”) space, and helping to promote and increase overall awareness around the entire marketplace of new and alternative data technologies, Big Data, and components enabling critical enterprise, government, web and mobile software systems.
![]() Jun. 27, 2012 04:46 PM EDT Reads: 494 |
By Liz McMillan ![]() Jun. 27, 2012 12:50 PM EDT Reads: 394 |
By Elizabeth White ![]() Jun. 27, 2012 12:42 PM EDT Reads: 438 |
By Jeremy Geelan ![]() Jun. 27, 2012 07:15 AM EDT Reads: 721 |
By Elizabeth White ![]() Jun. 26, 2012 05:00 AM EDT Reads: 4,235 |
By Liz McMillan Jun. 25, 2012 08:00 AM EDT Reads: 1,452 |
By Pat Romanski ![]() Jun. 25, 2012 05:45 AM EDT Reads: 2,155 |
By Liz McMillan ![]() Jun. 25, 2012 05:45 AM EDT Reads: 3,227 |
By Elizabeth White ![]() Jun. 25, 2012 05:15 AM EDT Reads: 3,990 |
By Pat Romanski ![]() Jun. 25, 2012 05:00 AM EDT Reads: 2,818 |
- Cloud Expo New York: Why PostgreSQL is the Database for the Cloud
- Cloud Expo New York Speaker Profile: Dave Asprey – Trend Micro
- Cloud Expo New York Speaker Profile: Jill T. Singer – NRO
- Cloud Expo New York Speaker Profile: Greg O'Connor – AppZero
- Cloud Expo New York Speaker Profile: Dave Linthicum – Blue Mountain Labs
- Cloud Expo New York Speaker Profile: Mårten Mickos – Eucalyptus Systems
- Cloud Expo New York Speaker Profile: George Gerchow – VMware
- Cloud Expo New York Speaker Profile: James Weir – UShareSoft
- Cloud Expo New York Speaker Profile: Bernard Golden – HyperStratus
- Gartner Hype Cycle 2011 - Emerging Technologies
- Twelve New Programming Languages: Is Cloud Responsible?
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Cloud Expo New York: Why PostgreSQL is the Database for the Cloud
- Cloud Expo New York Speaker Profile: Dave Asprey – Trend Micro
- Cloud Expo New York Speaker Profile: Jill T. Singer – NRO
- The Business Value of Cloud Computing
- Cloud Expo New York Speaker Profile: Greg O'Connor – AppZero
- iPad3 vs Windows 8 - and the Winner Is...Cloud
- Cloud Expo New York Speaker Profile: Dave Linthicum – Blue Mountain Labs
- Cloud Expo New York Speaker Profile: Mårten Mickos – Eucalyptus Systems
- Cloud Expo New York Speaker Profile: George Gerchow – VMware
- Cloud Expo New York Speaker Profile: James Weir – UShareSoft
- Cloud Expo New York Speaker Profile: Bernard Golden – HyperStratus
- Gartner Hype Cycle 2011 - Emerging Technologies
- What is Cloud Computing?
- The Top 150 Players in Cloud Computing
- Six Benefits of Cloud Computing
- Virtualization Conference Keynote Webcast Live on SYS-CON.TV
- What's the Difference Between Cloud Computing and SaaS?
- Twenty-One Experts Define Cloud Computing
- GDS International: Global Warming Scam?
- The Top 250 Players in the Cloud Computing Ecosystem
- The Future of Cloud Computing
- A Brief History of Cloud Computing: Is the Cloud There Yet?
- Cloud Expo Europe 2009 in Prague: Themes & Topics
- SOA 2 Point Oh No!