{"id":15353513,"url":"https://github.com/wf9a5m75/redis-android","last_synced_at":"2025-04-15T05:56:27.143Z","repository":{"id":52152085,"uuid":"121428470","full_name":"wf9a5m75/redis-android","owner":"wf9a5m75","description":"Cross-compiled RedisDB for Android","archived":false,"fork":false,"pushed_at":"2020-02-18T21:01:32.000Z","size":165026,"stargazers_count":105,"open_issues_count":2,"forks_count":29,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-15T05:56:17.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wf9a5m75.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOGS.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-13T19:47:20.000Z","updated_at":"2025-02-10T15:35:28.000Z","dependencies_parsed_at":"2022-09-02T00:41:13.636Z","dependency_job_id":null,"html_url":"https://github.com/wf9a5m75/redis-android","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wf9a5m75%2Fredis-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wf9a5m75%2Fredis-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wf9a5m75%2Fredis-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wf9a5m75%2Fredis-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wf9a5m75","download_url":"https://codeload.github.com/wf9a5m75/redis-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016320,"owners_count":21198832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T12:14:13.817Z","updated_at":"2025-04-15T05:56:27.104Z","avatar_url":"https://github.com/wf9a5m75.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# RedisDB on Android\n\n## Redis version\n\nMay/23/2019  **Redis 5.0.5**\n\n## Description\n\nRedis is known for NoSQL database. You can run Redis database on your server.\n\n**_This library helps you to run Redis database on Android device_**.\n\nThis library is just cross-compiled the [original redis database](https://redis.io/) for Android architectures such as ARM cpu.\n\nYou can run Redis database in background thread in your application.\n\n\n\n## Benefit of running Redis DB on Android\n\nThere are some benefits for running Redis DB on Android.\n\n  - NoSQL database in memory\n\n    The most remarkable feature of the Redis DB is `NoSQL`.\n    It means you can easily store data with key, and retrieve it (just like JSON object).\n\n  - No Internet is required\n\n    `MongoDB` or `Google Firebase` are known for NoSQL hosted on their cloud servers. However they need to connect to their server through the Internet.\n    It is depends on your purpose, but I wanted own hosted database on Android.\n\n  - `TTL` for key\n\n    One of my favorite points of Redis DB is you are able to set `TTL (time to live)`. You can save the key-value pairs that is available only in TTL time.\n\n  - `Publish/Subscriber`\n\n    One of the reason I created this library is Redis DB has `publisher/subscriber` mechanism, like a chat room.\n    You can notify your message from one application, and receive the data on another applications, even on multiple devices.\n\n  - No dependencies\n\n    One of the reason I gave up to use `Google Firebase` is that the library requires `Google Play Services`. But my Android does not have it (AOSP rom).\n    You can run Redis DB with **only this library.**\n\n## Install\n\nIn order to use this library, you need to add the below two lines into your `build.gradle` file.\n\n**build.gradle**\n```\nrepositories {\n    maven { url \"https://raw.githubusercontent.com/wf9a5m75/redis-android/master/repository/\" }\n}\n\ndependencies {\n    compile 'io.wf9a5m75:redis-android:1.1.6'\n}\n```\n\n## How to use this in your app?\n\n```java\nimport io.wf9a5m75.redis.RedisAndroid;\n\npublic class MyService extends IntentService {\n\n  public MyService() {\n    super(\"MyService\");\n  }\n\n  @Nullable\n  @Override\n  public IBinder onBind(Intent intent) {\n    return null;\n  }\n\n  @Override\n  protected void onHandleIntent(@Nullable Intent intent) {\n\n    Bundle configs = new Bundle();\n    configs.putString(\"port\", \"6379\");   // \u003c-- strongly recommend to change to different port number\n    configs.putString(\"protected-mode\", \"no\");\n    configs.putString(\"requirepass\", \"\");\n    RedisAndroid.start(this, configs);\n  }\n}\n```\n\n## Redis settings\n\nThis library specifies default settings for Android in the [RedisAndroid.java](https://github.com/wf9a5m75/redis-android/blob/master/redis-android/src/main/java/io/wf9a5m75/redis/RedisAndroid.java).\n\nYou can overwrite these settings for your purpose.\n\nFor example, the default `maxmemory = 10mb`, but if you want to increase it,\n\n```java\nBundle configs = new Bundle();\nconfigs.putString(\"port\", \"6379\");   // \u003c-- strongly recommend to change to different port number\nconfigs.putString(\"maxmemory\", \"30mb\");\nconfigs.putString(\"protected-mode\", \"no\");\nconfigs.putString(\"requirepass\", \"\");\nRedisAndroid.start(this, configs);\n```\n\nThe details of settings are defined at the http://download.redis.io/redis-stable/redis.conf\n\n## How to connect to the Redis DB from your app?\n\nYou need to use redis client libraries.\n\nhttps://redis.io/clients#java\n\n## redis-cli command\n\nYou need to install the command by your hand.\nYou may need **ROOT** permission of your device.\n\n(`redis-check-aof`, `redis-check-rdb` commands are also the same steps)\n\n1. Download the pre-build-libs.zip file from here.\n\nhttps://github.com/wf9a5m75/redis-android/releases\n\n2. Extract it\n\n3. push the `redis-cli` file into your device.\n\n```\n$\u003e adb root\n\n$\u003e adb remount // or adb shell 'mount -o rw,remount /system'\n\n$\u003e adb push redis-cli /system/xbin/redis-cli\n\n$\u003e adb shell chmod 0755 /system/xbin/redis-cli\n\n$\u003e adb shell chown root.shell /system/xbin/redis-cli\n\n$\u003e adb shell\n\n#\u003e redis-cli\n\n```\n\n# Playing with Redis\n\n```\nredis-cli -h 192.168.86.23\n192.168.86.23:6379\u003e ping\nPONG\n192.168.86.23:6379\u003e set foo bar\nOK\n192.168.86.23:6379\u003e get foo\n\"bar\"\n192.168.86.23:6379\u003e incr mycounter\n(integer) 1\n192.168.86.23:6379\u003e incr mycounter\n(integer) 2\n192.168.86.23:6379\u003e keys *\n1) \"mycounter\"\n2) \"foo\"\n192.168.86.23:6379\u003e get mycounter\n\"2\"\n192.168.86.23:6379\u003e\n```\n\n![](https://github.com/wf9a5m75/redis-android/blob/master/images/playing.gif?raw=true)\n\n# Version compatibles\n\n| Redis version | redis-android version |\n|---------------|-----------------------|\n| Redis 5.0.5   | v1.1.6                |\n| Redis 5.0.4   | v1.1.5                |\n| Redis 5.0.3   | v1.1.4                |\n| Redis 5.0.2   | v1.1.3                |\n| Redis 5.0.1   | v1.1.1 - v1.1.2       |\n| Redis 5.0.0   | v1.1.0                |\n| Redis 4.0.11  | v1.0.8                |\n| Redis 4.0.10  | v1.0.7                |\n| Redis 4.0.9   | v1.0.6                |\n| Redis 4.0.8   | v1.0.4 - v1.0.5       |\n| Redis 4.0.6   | v1.0.0 - v1.0.3       |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwf9a5m75%2Fredis-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwf9a5m75%2Fredis-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwf9a5m75%2Fredis-android/lists"}