Skip to content

Commit 9c57dff

Browse files
committed
Update README.md
1 parent 2892dfe commit 9c57dff

File tree

5 files changed

+205
-95
lines changed

5 files changed

+205
-95
lines changed

README.md

Lines changed: 13 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,24 @@
1-
# Heets is a simple cache server based on HTTP
2-
* Supported only get/set
3-
* Supported clustering nodes using Hazelcast
4-
5-
[![Build Status](https://travis-ci.org/code13k/heets.svg?branch=master)](https://travis-ci.org/code13k/heets)
1+
# Heets
2+
**Heets** is a simple cache server based on HTTP written in Java.
3+
Heets provide a solution to save data in memory. So it can respond data very quickly.
4+
Heets has three server. One is a getter server, another is setter server, and the other is restful API server.
65

6+
It provide get and set method via HTTP.
7+
You can set and get data using HTTP.
78

8-
## app_config.yml
9-
It's application configuration file.
10-
```yaml
11-
# Server port
12-
port:
13-
get_http: 55200
14-
set_http: 55201
15-
api_http: 55202
9+
It provide clustering nodes using Hazelcast.
10+
You can build high availability(HA) systems by clustering node.
1611

17-
# Cache
18-
cache:
19-
default_expires: 60
12+
[![Build Status](https://travis-ci.org/code13k/heets.svg?branch=master)](https://travis-ci.org/code13k/heets)
2013

21-
# Cluster
22-
cluster:
23-
port: 55210
24-
nodes:
25-
- 127.0.0.1
26-
```
2714

28-
## logback.xml
29-
It's Logback configuration file that is famous logging library.
30-
* You can send error log to Telegram.
31-
1. Uncomment *Telegram* configuration.
32-
2. Set value of `<botToken>` and `<chatId>`.
33-
```xml
34-
<appender name="TELEGRAM" class="com.github.paolodenti.telegram.logback.TelegramAppender">
35-
<botToken></botToken>
36-
<chatId></chatId>
37-
...
38-
</appender>
39-
```
40-
3. Insert `<appender-ref ref="TELEGRAM"/>` into `<root>`
41-
```xml
42-
<root level="WARN">
43-
<appender-ref ref="FILE"/>
44-
<appender-ref ref="TELEGRAM"/>
45-
</root>
46-
```
47-
* You can send error log to Slack.
48-
1. Uncomment *Slack* configuration.
49-
2. Set value of `<webhookUri>`.
50-
```xml
51-
<appender name="SLACK_SYNC" class="com.github.maricn.logback.SlackAppender">
52-
<webhookUri></webhookUri>
53-
...
54-
</appender>
55-
```
56-
3. Insert `<appender-ref ref="SLACK"/>` into `<root>`
57-
```xml
58-
<root level="WARN">
59-
<appender-ref ref="FILE"/>
60-
<appender-ref ref="SLACK"/>
61-
</root>
62-
```
63-
* You can reload configuration but need not to restart application.
6415

16+
### ![Configuration](./doc/configuration.md)
17+
### ![Getter Server](./doc/getter_server.md)
18+
### ![Setter Server](./doc/setter_server.md)
19+
### ![API Server](./doc/api_server.md)
6520

66-
# Server
67-
Perri has two servers.
68-
One is a getter server that read cached data.
69-
The other is a setter server that write data to caching store.
7021

7122

72-
## Get HTTP Server
73-
### Usage
74-
```html
75-
http://example.com:{port}/{key}
76-
```
77-
* port
78-
* Server port
79-
* It's *get_http* in app_config.yml.
80-
* key
81-
* Key for getting value
82-
### Example
83-
```html
84-
http://example.com:55200/example_key
85-
```
86-
87-
## Set HTTP Server
88-
```html
89-
http://example.com:{port}/{key}
90-
```
91-
* port
92-
* Server port
93-
* It's *set_http* in app_config.yml.
94-
* key
95-
* Key for getting value
96-
### Example
97-
```html
98-
http://example.com:55200/example_key
99-
{
100-
"value": "Test value",
101-
"content_type": "text/plain",
102-
"expires": 200
103-
}
104-
```
10523

10624

doc/api_server.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# API Server
2+
Heets has three server. One is a getter server, another is setter server, and the other is restful API server.
3+
4+
You can request api via HTTP.
5+
6+
7+
### Usage
8+
```html
9+
http://example.com:{port}/{domain}/{method}
10+
```
11+
12+
13+
### Example
14+
```html
15+
http://example.com:55202/app/env
16+
http://example.com:55202/app/status
17+
http://example.com:55202/app/hello
18+
http://example.com:55202/app/ping
19+
```
20+
21+
22+
# API (App)
23+
24+
## GET /app/env
25+
Get application environments
26+
```json
27+
{
28+
"data":{
29+
"applicationVersion": "1.4.0",
30+
"hostname": "hostname",
31+
"osVersion": "10.11.6",
32+
"jarFile": "code13k-heets-1.0.0-alpha.1.jar",
33+
"javaVersion": "1.8.0_25",
34+
"ip": "192.168.0.121",
35+
"javaVendor": "Oracle Corporation",
36+
"osName": "Mac OS X",
37+
"cpuProcessorCount": 4
38+
}
39+
}
40+
```
41+
42+
## GET /app/status
43+
Get application status
44+
```json
45+
{
46+
"data":{
47+
"threadInfo":{...},
48+
"cpuUsage": 2.88,
49+
"threadCount": 25,
50+
"currentDate": "2018-10-02T01:15:21.290+09:00",
51+
"startedDate": "2018-10-02T01:14:40.995+09:00",
52+
"runningTimeHour": 0,
53+
"vmMemoryUsage":{...}
54+
}
55+
}
56+
```
57+
58+
## GET /app/hello
59+
Hello, World
60+
```json
61+
{"data":"world"}
62+
```
63+
64+
## GET /app/ping
65+
Ping-Pong
66+
```json
67+
{"data":"pong"}
68+

doc/configuration.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Configuration
2+
Heets has two configuration files.
3+
4+
## app_config.yml
5+
It's application configuration file.
6+
```yaml
7+
# Server port
8+
port:
9+
get_http: 55200
10+
set_http: 55201
11+
api_http: 55202
12+
13+
# Cache
14+
cache:
15+
default_expires: 60
16+
17+
# Cluster
18+
cluster:
19+
port: 55210
20+
nodes:
21+
- 127.0.0.1
22+
```
23+
* Heets has three server. One is a getter server, another is setter server, and the other is restful API server. You can edit server port.
24+
* Heets is simple cache server. *default_expires* is used when you did not set expiration time for setting data.
25+
* Heets support clustering. You can cluster node by adding nodes IP.
26+
* If you don't use cluster mode, comment cluster configuration.
27+
28+
29+
## logback.xml
30+
It's Logback configuration file that is famous logging library.
31+
* You can send error log to Telegram.
32+
1. Uncomment *Telegram* configuration.
33+
2. Set value of `<botToken>` and `<chatId>`.
34+
```xml
35+
<appender name="TELEGRAM" class="com.github.paolodenti.telegram.logback.TelegramAppender">
36+
<botToken></botToken>
37+
<chatId></chatId>
38+
...
39+
</appender>
40+
```
41+
3. Insert `<appender-ref ref="TELEGRAM"/>` into `<root>`
42+
```xml
43+
<root level="WARN">
44+
<appender-ref ref="FILE"/>
45+
<appender-ref ref="TELEGRAM"/>
46+
</root>
47+
```
48+
* You can send error log to Slack.
49+
1. Uncomment *Slack* configuration.
50+
2. Set value of `<webhookUri>`.
51+
```xml
52+
<appender name="SLACK_SYNC" class="com.github.maricn.logback.SlackAppender">
53+
<webhookUri></webhookUri>
54+
...
55+
</appender>
56+
```
57+
3. Insert `<appender-ref ref="SLACK"/>` into `<root>`
58+
```xml
59+
<root level="WARN">
60+
<appender-ref ref="FILE"/>
61+
<appender-ref ref="SLACK"/>
62+
</root>
63+
```
64+
* You can reload configuration but need not to restart application.

doc/getter_server.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Getter Server
2+
Heets has three server. One is a getter server, another is setter server, and the other is restful API server.
3+
4+
You can get data via HTTP.
5+
6+
## Usage
7+
```html
8+
http://example.com:{port}/{key}
9+
```
10+
* port
11+
* Server port
12+
* It's *get_http* in app_config.yml.
13+
* key
14+
* Key for getting value
15+
16+
17+
## Example
18+
```html
19+
http://example.com:55200/example_key
20+
http://example.com:55200/example/key/data1
21+
```
22+

doc/setter_server.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Setter Server
2+
Heets has three server. One is a getter server, another is setter server, and the other is restful API server.
3+
4+
You can set data via HTTP.
5+
6+
## Usage
7+
* Method
8+
* POST
9+
* Content-Type
10+
* application/json
11+
* application/x-www-form-urlencoded
12+
* multipart/form-data
13+
* http://example.com:{port}/{key}
14+
* port
15+
* Server port
16+
* It's *set_http* in app_config.yml.
17+
* key
18+
* Key for getting value
19+
* Body
20+
```json
21+
{
22+
"value": "Value",
23+
"content_type": "text/plain",
24+
"expires": 200
25+
}
26+
```
27+
28+
## Example
29+
```html
30+
POST http://example.com:55201/example_key
31+
Content-Type : application/json
32+
33+
{
34+
"value": "Test value",
35+
"content_type": "text/plain",
36+
"expires": 200
37+
}
38+
```

0 commit comments

Comments
 (0)