RxSnappy

RxJava wrapper for SnappyDB

License

License

GroupId

GroupId

io.supercharge
ArtifactId

ArtifactId

rxsnappy
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

aar
Description

Description

RxSnappy
RxJava wrapper for SnappyDB
Project URL

Project URL

https://github.com/team-supercharge/rxsnappy
Source Code Management

Source Code Management

https://github.com/team-supercharge/rxsnappy

Download rxsnappy

How to add to project

<!-- https://jarcasting.com/artifacts/io.supercharge/rxsnappy/ -->
<dependency>
    <groupId>io.supercharge</groupId>
    <artifactId>rxsnappy</artifactId>
    <version>0.4.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/io.supercharge/rxsnappy/
implementation 'io.supercharge:rxsnappy:0.4.0'
// https://jarcasting.com/artifacts/io.supercharge/rxsnappy/
implementation ("io.supercharge:rxsnappy:0.4.0")
'io.supercharge:rxsnappy:aar:0.4.0'
<dependency org="io.supercharge" name="rxsnappy" rev="0.4.0">
  <artifact name="rxsnappy" type="aar" />
</dependency>
@Grapes(
@Grab(group='io.supercharge', module='rxsnappy', version='0.4.0')
)
libraryDependencies += "io.supercharge" % "rxsnappy" % "0.4.0"
[io.supercharge/rxsnappy "0.4.0"]

Dependencies

compile (4)

Group / Artifact Type Version
com.snappydb : snappydb-lib jar 0.5.2
com.google.code.gson : gson jar 2.5
io.reactivex : rxjava jar 1.0.14
com.esotericsoftware.kryo : kryo jar 2.24.0

Project Modules

There are no modules declared in this project.

Build Status Android Arsenal Maven Central #RxSnappy

RxSnappy is a thread safe rxjava wrapper for the great SnappyDB fast key-value database for Android.

This library offers a time based raw response cache solution on client side.

Usage

  • Get artifact
compile 'io.supercharge:rxsnappy:0.4.0'
  • In application's onCreate() call
RxSnappy.init(context);
  • Create RxSnappyClient
RxSnappyClient rxSnappyClient = new RxSnappyClient();

rxSnappyClient.setObject(key, object).subscribe(object -> ...);

rxSnappyClient.getObject(key, Object.class).subscribe(object -> ...);
  • Every record automatically gets an id which id is the date in milliseconds of the insertion
public Observable<FooResponse> getFooResponse(String token, BarRequest barRequest){

//Generate unique key 
final String key = RxSnappyUtils.generateKey("fooresponse", token, barRequest);

//Look for in cache with a time interval (ms)
//If the data in cache is older than 15 sec it throws an exception
return rxSnappyClient.getObject(key, 15000L, FooResponse.class)
	.onErrorResumeNext(retrofitApi.getFooResponse(token, barRequest)
		.flatMap(fooResponse -> rxSnappyClient.setObject(key, fooResponse));
}

Contributing

Please fork this repository and create a pull request Any contributions, large or small, major features, bug fixes, unit tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

Run the instumentation tests before PR!

License

RxSnappy is opensource, contribution and feedback are welcomed

Apache Version 2.0

Copyright 2015 Supercharge

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.

Author

richardradics

Supercharge

io.supercharge

Supercharge

We create stunning experiences on mobile and on the web

Versions

Version
0.4.0
0.3.0
0.2.0
0.1.0
0.0.1