/** * Get the cache singleton associated with these parameters. * * @param priority * @param cacheType * @param startupTask * @return * @throws FlashDatabaseException */ public FlashCache getFlashCache( final char priority, final int cacheType, final FlashCache.StartupTask startupTask) throws FlashDatabaseException { switch (cacheType) { case PlatformUtils.PHONE_DATABASE_CACHE: try { return new RMSFastCache(priority, startupTask); } catch (Exception e) { // #debug L.e( "Can not create flash cache, will attempt delete and re-init one time", "" + priority, e); RMSFastCache.deleteDataFiles(priority); try { final RMSFastCache cache = new RMSFastCache(priority, startupTask); // #debug L.i( "After deleting the files giving and error, we successfully created flash cache", "" + priority); return cache; } catch (Exception e2) { throw new FlashDatabaseException("Can not create flash cache: " + e2); } } default: throw new IllegalArgumentException( "Unsupported cache type " + cacheType + ": only PlatformAdapter.PHONE_DATABASE_CACHE is supported at this time"); } }
/** * Delete the files or RMS associated with this cache * * @param priority * @param cacheType */ public void deleteFlashCache(final char priority, final int cacheType) { if (cacheType != PlatformUtils.PHONE_DATABASE_CACHE) { throw new UnsupportedOperationException( "Not supported yet. Only PlatformUtils.PHONE_DATABASE_CACHE can be deleted (or created)"); } RMSFastCache.deleteDataFiles(priority); }