Giter VIP home page Giter VIP logo

memorystore's Introduction

๐Ÿš€ MemoryStore: The Speedy In-Memory ๐Ÿ—‚ Key-Value Store ๐Ÿ› ๏ธ

MemoryStore is an ultra-fast, in-memory key-value database developed in Go, emphasizing rapid data access, simple integration, and robust thread-safe operations. It excels in handling byte-slice data with flexible serialization options.

Quick Start

Clone and navigate to the MemoryStore repository:

git clone https://github.com/BryceWayne/MemoryStore.git
cd MemoryStore

How to Use

MemoryStore accepts []byte as values, accommodating various serialization methods (JSON, gob, protobuf, etc.). Here's a quick guide to integrate MemoryStore into your Go application:

import (
    "github.com/goccy/go-json" // Recommended for added performance in JSON serialization
    "log"
    "time"

    "github.com/BryceWayne/MemoryStore/memorystore"
)

type YourData struct {
    // Define your data structure here
}

func main() {
    ms := memorystore.NewMemoryStore()
    defer ms.Stop()

    // Convert your data to a byte slice
    dataToStore := YourData{/* ... */}
    serializedData, err := json.Marshal(dataToStore)
    if err != nil {
        log.Fatal(err)
    }

    // Store the data
    ms.Set("yourKey", serializedData, 10*time.Second)

    // Retrieve and use the data
    if data, found := ms.Get("yourKey"); found {
        var yourData YourData
        if err := json.Unmarshal(data, &yourData); err != nil {
            log.Fatal(err)
        }
        // Process `yourData`...
    }

    // Remove the data
    ms.Delete("yourKey")
}

Building and Testing

Build the project with the Makefile:

make build

This compiles the source into an executable.

Test the functionality:

make test

Contributions

Your contributions make MemoryStore better. Feel free to submit pull requests, open issues for discussion, suggestions, or bug reports.

memorystore's People

Contributors

brycewayne 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.