Git Product home page Git Product logo

cache's Introduction

Cache

What exactly cache does?

The purpose of cache is to create N HTTP server proxies that intercept requests, make the request to the actual server and persists both request and response info (body + headers). Then the client receives the response transparently. If somebody requests the same resource again, it will get the cached response.

Why?

With cache, you can make quick n' dirty integration tests. Sometimes you don't have the time to mock all your services, or you have to replicate an special scenario or play around with the header responses. Cache helps you to inspect your requests and responses.

Installation

If you have a Go installation you can get the development version:

go get -u github.com/thewraven/cache

the fresh binary is in your $GOPATH/bin folder.

If you want a ready-to-use binary, you can grab'em here.

Usage

cache -config yourservers.json

yourservers.json defines the proxies that will be run.

This is an example of a simple server configuration.

  • Remote: the ip:port of the real server.
  • Local: the ip:port of the proxy.
  • Cache: if it is set to true, it'll reuse the latest response of the real server.
  • Timeout (minutes): After x minutes, the latest server response will be invalidated.
  • Cache_path: Folder when the requests and responses will be persisted.

You can define an array of configurations, cache will spawn as many servers as required.

[
    {
        "remote": "yourrealserver.com:8888",
        "local": ":9999",
        "cache": true,
        "timeout_minutes": 10,
        "cache_path": "your_cache_folder"
    }
]

cache's People

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.