Need advice about which tool to choose?Ask the StackShare community!

LokiJS

36
55
+ 1
3
Redis

58.2K
44.8K
+ 1
3.9K
Add tool

LokiJS vs Redis: What are the differences?

Introduction: In this article, we will discuss the key differences between LokiJS and Redis, two popular databases used in web development. LokiJS is a lightweight JavaScript in-memory database that provides a document-oriented data model. On the other hand, Redis is an in-memory data structure store that can be used as a database, cache, and message broker. Now, let's explore the specific differences between these two databases.

  1. Data Persistence: LokiJS stores data in memory by default, which means that the data is lost once the application is closed or restarted. However, LokiJS also provides options to persist data to disk, allowing for data to be saved and loaded between application sessions. In contrast, Redis is designed for durable persistence and can save data to disk or replicate it across multiple nodes for data protection and high availability.

  2. Data Scalability: LokiJS is suitable for small to medium-sized applications with a limited amount of data. It is not designed for high-scale applications that require horizontal scaling. Redis, on the other hand, is highly scalable and can handle large amounts of data by distributing it across multiple nodes in a cluster. This makes Redis a preferred choice for applications with high data loads and heavy read and write traffic.

  3. Data Model: LokiJS provides a document-oriented data model similar to NoSQL databases like MongoDB. It allows for flexible and schema-less data structures, making it easy to store and manipulate complex data objects. Redis, on the other hand, provides a key-value data model where data is stored as a simple key-value pair. While Redis supports various data types like strings, hashes, lists, sets, and sorted sets, it does not support complex nested data structures like NoSQL databases.

  4. Data Querying: LokiJS provides a powerful querying engine that allows for complex queries using a MongoDB-inspired syntax. It supports various query operators and can efficiently search and filter data based on different criteria. Redis, on the other hand, does not provide a built-in query language. Instead, it relies on simple key-based operations like GET, SET, and DEL. To perform complex querying in Redis, additional tools or libraries need to be used.

  5. Data Replication: LokiJS does not have built-in support for data replication. If data needs to be replicated across multiple instances or nodes, it needs to be implemented manually. Redis, on the other hand, supports various replication modes like master-slave replication and cluster replication. This allows for automatic data synchronization between multiple instances, ensuring high availability and fault tolerance.

  6. Data Persistence Options: In terms of data persistence options, LokiJS provides the flexibility to choose between different persistence adapters like localStorage, indexedDB, and file system storage. This allows developers to select the most suitable option based on their application requirements and environment. Redis, on the other hand, provides a built-in persistence mechanism that can save data to disk in a compact and efficient manner.

In summary, LokiJS and Redis differ in terms of data persistence, scalability, data model, querying capabilities, data replication support, and data persistence options. While LokiJS is lightweight and suitable for small to medium-sized applications, Redis is highly scalable and designed for high-scale applications with complex data structures.

Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of LokiJS
Pros of Redis
  • 3
    Can query the objects directly
  • 886
    Performance
  • 542
    Super fast
  • 513
    Ease of use
  • 444
    In-memory cache
  • 324
    Advanced key-value cache
  • 194
    Open source
  • 182
    Easy to deploy
  • 164
    Stable
  • 155
    Free
  • 121
    Fast
  • 42
    High-Performance
  • 40
    High Availability
  • 35
    Data Structures
  • 32
    Very Scalable
  • 24
    Replication
  • 22
    Great community
  • 22
    Pub/Sub
  • 19
    "NoSQL" key-value data store
  • 16
    Hashes
  • 13
    Sets
  • 11
    Sorted Sets
  • 10
    NoSQL
  • 10
    Lists
  • 9
    Async replication
  • 9
    BSD licensed
  • 8
    Bitmaps
  • 8
    Integrates super easy with Sidekiq for Rails background
  • 7
    Keys with a limited time-to-live
  • 7
    Open Source
  • 6
    Lua scripting
  • 6
    Strings
  • 5
    Awesomeness for Free
  • 5
    Hyperloglogs
  • 4
    Transactions
  • 4
    Outstanding performance
  • 4
    Runs server side LUA
  • 4
    LRU eviction of keys
  • 4
    Feature Rich
  • 4
    Written in ANSI C
  • 4
    Networked
  • 3
    Data structure server
  • 3
    Performance & ease of use
  • 2
    Dont save data if no subscribers are found
  • 2
    Automatic failover
  • 2
    Easy to use
  • 2
    Temporarily kept on disk
  • 2
    Scalable
  • 2
    Existing Laravel Integration
  • 2
    Channels concept
  • 2
    Object [key/value] size each 500 MB
  • 2
    Simple

Sign up to add or upvote prosMake informed product decisions

Cons of LokiJS
Cons of Redis
    Be the first to leave a con
    • 15
      Cannot query objects directly
    • 3
      No secondary indexes for non-numeric data types
    • 1
      No WAL

    Sign up to add or upvote consMake informed product decisions

    - No public GitHub repository available -

    What is LokiJS?

    LokiJS is a document oriented database written in javascript, published under MIT License. Its purpose is to store javascript objects as documents in a nosql fashion and retrieve them with a similar mechanism. Runs in node (including cordova/phonegap and node-webkit), nativescript and the browser.

    What is Redis?

    Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams.

    Need advice about which tool to choose?Ask the StackShare community!

    Jobs that mention LokiJS and Redis as a desired skillset
    LaunchDarkly
    Oakland, California, United States
    What companies use LokiJS?
    What companies use Redis?
    See which teams inside your own company are using LokiJS or Redis.
    Sign up for StackShare EnterpriseLearn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with LokiJS?
    What tools integrate with Redis?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    Blog Posts

    Nov 20 2019 at 3:38AM

    OneSignal

    PostgreSQLRedisRuby+8
    9
    4642
    Jun 6 2019 at 5:11PM

    AppSignal

    RedisRubyKafka+9
    15
    1644
    GitHubDockerReact+17
    40
    36281
    What are some alternatives to LokiJS and Redis?
    SQLite
    SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.
    Pouchdb
    PouchDB enables applications to store data locally while offline, then synchronize it with CouchDB and compatible servers when the application is back online, keeping the user's data in sync no matter where they next login.
    NeDB
    Embedded persistent or in memory database for Node.js, nw.js, Electron and browsers, 100% JavaScript, no binary dependency. API is a subset of MongoDB's and it's plenty fast.
    MongoDB
    MongoDB stores data in JSON-like documents that can vary in structure, offering a dynamic, flexible schema. MongoDB was also designed for high availability and scalability, with built-in replication and auto-sharding.
    IndexedDB
    This API uses indexes to enable high-performance searches of this data. While Web Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data.
    See all alternatives