A File based key-value Data Store
A File based key-value data store that can be used in your project to store data in key value pairs in json file in your local machine. The Data_Store is very light weight and can be used in a small or medium level projects. The Time to live property is a great feature if you don't want the data to be stored permanently. It destroys the data automatically after the time has expired.
- File stored as json
- Time to Live
To get a local copy up and running follow these simple steps.
- Clone the repo
git clone https://github.com/darwinwilmut/Freshwork-Assignment.git
-
Copy the
Data_storepackage folder into your project. -
Import the
Data_Storemodule into your python filefrom Main_code import * -
path can be set manually or path will be set default to current working Directory with file name "Sample.json"
set_path('Your path') -
Create data in Data_store.
# the key must be string # it takes key and value as the parameter create('key',value) # the default time to live value is 0 which means None. # you can set time to live property # it takes integer value (seconds) as the parameter set_delay(seconds)
-
Read data from store.
# it takes key as the parameter read('key')
-
Delete data in store.
# it takes key as the parameter delete('key')