Git Product home page Git Product logo

aremumahmud / db-cache-system Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 14 KB

a database cache system for seamlessly fast data interaction which offer up to zero time complexity. This module allows data to be changed and exported before it is written to the database to reduce time spent on i/o while the writing to the database is done in the background

License: Apache License 2.0

JavaScript 100.00%

db-cache-system's Introduction

db-cache-system

This is a datastructure for caching a database which makes it a database cache system for seamlessly fast data interaction which offer up to zero time complexity. This module allows data to be changed and exported before it is written to the database to reduce time spent on i/o while the writing to the database is done in the background

cacheDS.loadCollection( collection , document , callback) / cacheDS.loadCollections(collection , document , callback)

This method allows the loading of documents in to the datastructure and creating a collection lets create a bakery collection

const cacheDs = require('./cacheDs')
let cache = new cacheDs()

let document =  [
   {
     "caketype": " synergy",
     "cakecus": "ayila",
     "_id": "Jgp2Fx70i6dLxdKGYNxF"
   },
   {
     "caketype": " synellrgy",
     "cakecus": "ayila",
     "_id": "79NwXmllctcodfgxoxs0"
   },
   {
     "caketype": " sylnergy",
     "cakecus": "ayila",
     "_id": "m64u07bYJPnw8Y6kjxe5"
   },
   {
     "caketype": " syneklrgy",
     "cakecus": "ayi;lla",
     "_id": "921S2YT1Oy1g8f822Xo1"
   },
   {
     "caketype": " syllnergy",
     "cakecus": "ayil;.a",
     "_id": "9UQC7x3q8ha3h2R0pM01"
   },
   {
     "caketype": " synergy",
     "cakecus": "ayillla",
     "_id": "9UQC7x3q8ha3h2R0pM01"
   }
]

cache.loadCollection('bakery' , document , ()=>{
       console.log(cache.collections)
})

cacheDS.find(collection , parameters , callback)

This method allows the searching through the datastructure . it is written with speed in mind as you can search through millions of documents and data at T(O) = 0<x<1 where the time is noted in milliseconds an example can be shown as we try to find through the bakery collection as we pass through the parametrs for finding data with a specific id

 cache.loadCollection('bakery' , data , ()=>{
       // console.log(cach.collections)
        cache.find('bakery' , {_id:'79NwXmllctcodfgxoxs0'} , (err,found)=>{
            //console.log(err,found)
        })
})

cacheDS.update(collection , parameters , callback)

This method allow to update data in the cache. example is shown

  cache.loadCollection('bakery' , data , ()=>{
        cache.update('bakery' , {find :{_id: "9UQC7x3q8ha3h2R0pM01"} , updateWith : {cakecus : 'kondo'} } , (err,updated)=>{
         
        })

    })

cacheDS.delete(collection , parameters , callback)

This method allow to delete data in the cache. example is shown

  cache.loadCollection('bakery' , data , ()=>{
        cache.update('bakery' , {_id: "9UQC7x3q8ha3h2R0pM01"}, (err,deleted)=>{
         
        })

    })

db-cache-system's People

Contributors

aremumahmud avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.