Coder Social home page Coder Social logo

eminmuhammadi / memcache Goto Github PK

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

Fast, simple, in-memory key-value caching using HTTP/HTTPS

License: GNU General Public License v3.0

Shell 1.12% Go 98.88%
cache cache-control http-cache memory memory-cache

memcache's Introduction

memcache

Codacy Security Scan CodeQL

Fast, simple, in-memory key-value caching using HTTP/HTTPS.

Note: All values are stored as strings in utf-8 encoding.

Installation

git clone https://github.com/eminmuhammadi/memcache && cd memcache && chmod +x ./install.sh && ./install.sh

Note: GCC is required to build from source.

Simple Usage

memcache start --hostname 0.0.0.0 --port 8080

Options

   --hostname value         network interface to listen on
   --port value             network port to listen on
   --timezone value         timezone to use for time.Time (default: "UTC")
   --logLevel value         log level to use; one of: info, warn, error, silent (default: "SILENT")
   --bodyLimit value        in bytes (1024 * 1024 = 1MB) (default: 4194304)
   --readBufferSize value   in bytes (default: 4096)
   --writeBufferSize value  in bytes (default: 4096)
   --readTimeout value      in seconds (default: 15)
   --writeTimeout value     in seconds (default: 15)
   --idleTimeout value      in seconds (default: 60)
   --prefork                enable preforking
   --concurrency value      number of concurrent connections to handle (default: 262144)
   --secure                 enable TLS
   --certFile value         path to TLS certificate file
   --keyFile value          path to TLS key file

To see details about the available options, run memcache start --help. If you want to disable banner, you need to set MEMCACHE_DISABLE_BANNER environment variable to any value.

Note: If you want to use prefork mode in docker container, you need to run it with CMD ./memcache or CMD ["sh", "-c", "/memcache"].

Usage

Set a value

curl -L -X POST '127.0.0.1:8080/' \
-H 'Content-Type: application/json' \
--data-raw '{
    "value": "Hello World!"
}'

Get a value

curl -L -X GET '127.0.0.1:8080/068ddfad-9288-4c39-90b2-98e51b9759da' \
-H 'Content-Type: application/json'

Delete a value

curl -L -X DELETE '127.0.0.1:8080/068ddfad-9288-4c39-90b2-98e51b9759da' \
-H 'Content-Type: application/json'

Edit a value

curl -L -X PUT '127.0.0.1:8080/45620163-14d5-49c9-9e64-76f97006efea' \
-H 'Content-Type: application/json' \
--data-raw '{
    "value": "Hello New World!"
}'

Metrics

Following metrics are available:

  • Prometheus metrics: <protocol>://<ip>:<port>/_/metrics
  • Health check: <protocol>://<ip>:<port>/_/healthcheck
  • Monitoring (OS Information, Memory, CPU, etc.): <protocol>://<ip>:<port>/_/monitoring

memcache's People

Contributors

eminmuhammadi avatar

Watchers

 avatar

Forkers

avary

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.