qwazr / jdbc-cache-driver

A JDBC Cache Driver
7 stars 11 forks source link

Add support for Mmap based JDBC cache #21

Open emmanuel-keller opened 7 years ago

emmanuel-keller commented 7 years ago

Implements a new type of cache using Mmap files with the URL: jdbc:cache:mmap:{path-to-the-cache-directory} for on disk cache

Thanks to Mmap, this type of cache will provide file system persistence as well as in memory performances.

// Initialize the cache driver Class.forName("com.qwazr.jdbc.cache.Driver");

// Provide the URL and the Class name of the backend driver Properties info = new Properties(); info.setProperty("cache.driver.url", "jdbc:derby:mmap:myDB;create=true"); info.setProperty("cache.driver.class", "org.apache.derby.jdbc.EmbeddedDriver"); // Get your JDBC connection Connection cnx = DriverManager.getConnection("jdbc:cache:mmap:my-mmap-cache", info);