Skip to content

Jonbeckas/Beast

Repository files navigation

Beast

Beast is an easy to use Key/Value storage manager using Google's Gson serializer.

Getting Started

Create a new instance of Beast and give it a StoragType

     Beast b = new Beast(new StoreToFile( CacheType,File));

CacheTypes

NO_CACHE: Never caches CACHE_ON_START: Caches every stored Data on start CACHE: Caches reuested values only

Get a BeastItem

     BeastItem  bi = b.get(id);

If storeId does not exist, Beast add it using the default StorageType.

Store a Value

    bi.set(object);

Get a Value

   Object value = bi.get();

Get a List

   List<Object> arrayList = bi.getList();

Move a Value

You can move a Value from a StorageType to an other

 bi.move(storageId);

Remove a value

 bi.remove();

Register an other StorageType

 b.addStorageType("storageId",StorageType);

Register BeastItem in an other StorageType

 BeastItem bi = b.create(id,storageTypeid)

Create custom StorageType

Just extend the abstract StorageType class and call

 super.loadCache();

at the end of your constructor;

Create custom Serializer

Just implement the Serializer interface

Install

Gradle

Add JitPack Repository

repositories {
    maven { url 'https://jitpack.io' }
}

Add Dependency

dependencies {
    implementation 'com.github.Jonbeckas:Beast:version'
}

Maven

Add JitPack Repository

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Add Dependency

<dependency>
    <groupId>com.github.Jonbeckas</groupId>
    <artifactId>Beast</artifactId>
    <version>Version</version>
</dependency>

Used Librarys

Gson

Project:

https://github.com/google/gson

Licence:

Copyright 2008 Google Inc.

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.