Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rajnikant7008/cache-service

Cache as a Micro Service
https://github.com/rajnikant7008/cache-service

cache cache-control cache-service cache-storage java java-8 junit junit-test spring spring-boot spring-mvc

Last synced: about 1 month ago
JSON representation

Cache as a Micro Service

Awesome Lists containing this project

README

        

# Cache Service Rest APIs

**Add to cache**
----
Returns boolean response.

* **URL:**
/v1/cache/add

* **Method:**
`POST`

* **Body**

**Content:** `{ "key" : "country"", "value" : "capital" }`

* **Success Response:**

* **Code:** 201

**Content:** `{ true }`

* **Sample Call:**

```
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"key": "country", \
"value": "capital" \
}' 'https://cache-service.herokuapp.com/v1/cache/add'
```

**Get from cache**
----
Returns element from cache for a given key.

* **URL:**
/v1/cache/get/{key}

* **Method:**
`GET`

* **URL Params**

**Required:**
`key=[string]`

* **Success Response:**

* **Code:** 200

**Content:** `{ "Value" }`

* **Error Response:**

* **Code:** 204 No Content

**Content:** `{ no content }`

* **Sample Call:**

```
curl -X GET --header 'Accept: application/json'
'https://cache-service.herokuapp.com/v1/cache/get/country'
```

**Peek from cache**
----
Returns most recently added element from cache.

* **URL:**
/v1/cache/peek

* **Method:**
`GET`

* **URL Params**

**Required:**
None

* **Success Response:**

* **Code:** 200

**Content:** `{ "Value" }`

* **Error Response:**

* **Code:** 204 No Content

**Content:** `{ no content }`
* **Sample Call:**

```
curl -X GET --header 'Accept: application/json'
'https://cache-service.herokuapp.com/v1/cache/peek'

```
**Take from cache**
----
Retrieves and removes the most recently added element from the
cache.

* **URL:**
/v1/cache/take

* **Method:**
`GET`

* **URL Params**

**Required:**
None

* **Success Response:**

* **Code:** 200

**Content:** `{ "Value" }`

* **Error Response:**

* **Code:** 204 No Content

**Content:** `{ no content }`
* **Sample Call:**

```
curl -X GET --header 'Accept: application/json'
'https://cache-service.herokuapp.com/v1/cache/take'
```
**Remove from cache**
----
Returns true if the element was successfully removed.

* **URL:**
/v1/cache/remove/{key}

* **Method:**
`DELETE`

* **URL Params**

**Required:**
`key=[string]`

* **Success Response:**

* **Code:** 200

**Content:** `{ true }`

* **Sample Call:**

```
curl -X DELETE --header 'Accept: application/json'
'https://cache-service.herokuapp.com/v1/cache/remove/country'
```