All Projects → Michaelliu1989 → Mlcache

Michaelliu1989 / Mlcache

Licence: apache-2.0
A library make cache easily

Projects that are alternatives of or similar to Mlcache

Once
A magic memoization function
Stars: ✭ 821 (+9022.22%)
Mutual labels:  cache
Deepcache
Cache design for CNN on mobile
Stars: ✭ 22 (+144.44%)
Mutual labels:  cache
Harmony
Multi-process SharedPreference implementation without ContentProvider
Stars: ✭ 27 (+200%)
Mutual labels:  sharedpreferences
React Native Cached Image
CachedImage component for react-native
Stars: ✭ 890 (+9788.89%)
Mutual labels:  cache
Simple Cache
An easy to use Caching trait for Laravel's Eloquent Models.
Stars: ✭ 19 (+111.11%)
Mutual labels:  cache
Cache Service Provider
A Cache Service Provider for Silex, using the doctrine/cache package
Stars: ✭ 23 (+155.56%)
Mutual labels:  cache
Django Cachalot
No effort, no worry, maximum performance.
Stars: ✭ 790 (+8677.78%)
Mutual labels:  cache
Gparticlesio
Simple IO transfer particles cache in DCC application
Stars: ✭ 8 (-11.11%)
Mutual labels:  cache
Httpcache
Get a working HTTP Cache in Go (Golang) with only 3 lines of code!!!!
Stars: ✭ 17 (+88.89%)
Mutual labels:  cache
Go Cache Demo
Demo repository on how to use server side cache in Go
Stars: ✭ 26 (+188.89%)
Mutual labels:  cache
Typedvalue
Tiny library to simplify access to SharedPreferences, Bundle or any other key-value storage
Stars: ✭ 18 (+100%)
Mutual labels:  sharedpreferences
Lazycache
An easy to use thread safe in-memory caching service with a simple developer friendly API for c#
Stars: ✭ 901 (+9911.11%)
Mutual labels:  cache
Hazelcast Hibernate
A distributed second-level cache for Hibernate
Stars: ✭ 24 (+166.67%)
Mutual labels:  cache
Shpref Library
💾 Android Kotlin library. Shared preferences wrapper. (2020)
Stars: ✭ 16 (+77.78%)
Mutual labels:  sharedpreferences
Wordpress Rest Cache
WordPress Plugin to lazy cache HTTP requests in database and update via cron.
Stars: ✭ 8 (-11.11%)
Mutual labels:  cache
Cleanmywechat
自动删除 PC 端微信缓存数据,包括从所有聊天中自动下载的大量文件、视频、图片等数据内容,解放你的空间。
Stars: ✭ 816 (+8966.67%)
Mutual labels:  cache
Vue Navigation
A page navigation library, record routes and cache pages, like native app navigation. 一个页面导航库,记录路由并缓存页面,像原生APP导航一样。
Stars: ✭ 920 (+10122.22%)
Mutual labels:  cache
Weixinmpsdk
微信全平台 SDK Senparc.Weixin for C#,支持 .NET Framework 及 .NET Core、.NET 6.0。已支持微信公众号、小程序、小游戏、企业号、企业微信、开放平台、微信支付、JSSDK、微信周边等全平台。 WeChat SDK for C#.
Stars: ✭ 7,098 (+78766.67%)
Mutual labels:  cache
Key Cache
Storing data in the form of key into the file
Stars: ✭ 8 (-11.11%)
Mutual labels:  cache
Cache Chunk Store
In-memory LRU (least-recently-used) cache for abstract-chunk-store compliant stores
Stars: ✭ 24 (+166.67%)
Mutual labels:  cache

MLCache

This is An Android library which can help you reorganize cache more conveniently(based on K-Value)

In the development of a project,we normally need at least two cache to store information.one is used to cache user info,another to cache app info,and sometimes we may even need a third one to cache http response.

This project can make the establishment and management of cache more easily,which means you can store,fetch and wipe data with no efforts.

Getting started

In your build.gradle:

dependencies {
    compile 'com.michael:MLCache:1.0.0'
}

Usage

Step 1. initialize in application

public class BaseApp extends Application{
    @Override
    public void onCreate() {
        super.onCreate();
        CacheManager.init(getApplicationContext());
    }
}

Step 2. Create a cache option in everywhere you want, but it is better to create in Constants class.

public class Constants {
    public static final CacheOptions userCacheOptions = new CacheOptions.Builder().debugable(false).defaultCacheType(CacheOptions.TYPE_PREFERENCE).defaultFileName("user_cache").build();
}

Step 3. save、get、remove、clear values, don't forgot to invoke apply() when save values, for example:

// sava values
CacheManager.instance(Constants.userCacheOptions)
                .put("userName", "Michael")
                .put("married", false)
                .put("float", 0.1f)
                .put("age", 28)
                .put("long", 1L)
                .apply();
                
// get value
String userName = CacheManager.instance(Constants.userCacheOptions).get("userName", "");

// tests whether the value exists
boolean containUser = CacheManager.instance(Constants.userCacheOptions).contains("userName");

// remove value
CacheManager.instance(Constants.userCacheOptions).remove("userName");

// clear values
CacheManager.instance(Constants.userCacheOptions).clear();

Step 4. add the proguard-rules

-keep class sun.misc.**
-keep class sun.nio.**
-keep class java.beans.**
-keep class sun.nio.ch.**
-keep class com.snappydb.**
-keep class com.snappydb.internal.DBImpl { *; }
-keep class com.esotericsoftware.kryo.** { *; }
-dontwarn com.esotericsoftware.kryo.**
-dontwarn org.objenesis.instantiator.**

Depend

Snappydb is download from:https://github.com/nhachicha/SnappyDB

License

Copyright 2017 Michael.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].