GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - simpleton/Yasp: Yet Another Shared Preference

BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
gradle
gradle
 
 
leveldb
leveldb
 
 
sample
sample
 
 
yasp-leveldb
yasp-leveldb
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Yet Another SharedPreference

Download Build Status

This library try to introduce a high performance K-V store in Android development to instead of SharedPreference.

Why

If you only need to persist simple values and your application runs in a single process SharedPreferences is probably enough for you. It is a good default option.

There are some situations where SharedPreferences are not suitable for store KV data:

  1. Performance: Your data is complex or there is a lot of it
  2. Multiple thread accessing the data: invoke editor.appy() or editor.commit() multiple time, even apply will submit work to other thread.
  3. Multiple processes accessing the data: You have widgets or remote services that run in their own processes and require synchronized data

Yasp-leveldb

This library is wrapped LevelDB in java with SharedPreference interface.

Download

Use Gradle:

implementation 'com.simsun.yasp:yasp-leveldb:0.0.3'

API Usage

Almost compat with Android SharedPreference, but there is a little different during initializing.

Yasp will NOT load whole file when you access one parameter. Feel free to cache yasp instance in your Application.

Init

SharedPreferences sp = YASPContext.with(Context ct).getSharedPreferences(String name, int mode);

Do NOT support multiple processes currently

Get

As same as Android SharedPreference

sp.getString(String key, String defaultVal);

Editor

As same as Android SharedPreference

sp.edit()
  .putString(String key, String value)
  .putInt(String key, int value)
  .apply();

Benchmark

// TODO

Reference

  1. Best practices in Android development
  2. 请不要滥用SharedPreference

About

Yet Another Shared Preference

Topics

androidkvstoresharedpreferences

Resources

Readme
Apache-2.0 license
Activity

Stars

16 stars

Watchers

3 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.