hackjutsu / hackjutsu/memcached-java-demo

memcached 命令行

オープン
#1 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
1
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

説明

## Starting memcached

### 默认端口 11211, 如果想要改变端口,用-p

```
memcached -p 8000
memcached -d -p 8000
```

### 如何判断memcached已经启动过了

```
ps aux | grep memcached
```

### 退出memcached

```
quit
```

### 终止memcached service

```
brew install pidof
pidof memcached
```
```
kill -9
```

```
memcached -p 11111 -U 11111 -u user -d
-p is for TCP port number
-U is for UDP port number
-u is for user name
-d runs memcached as daemon process
```

## Connect to memcached

```
# 连接 memcached
telnet 127.0.0.1 11211
```

## Storage Commands
### Set Data
Memcached set command is used to set a value to key; if the key does not exist, a new key is created and value is assigned to that key.

`set key flags exptime bytes`

- key - It is the name of the unique key by which data is accessed.
- flags - It is the 32-bit unsigned integer that the server stores with the data provided by the user, and returns along with the data when the item is retrieved.
- exptime - It is the expiration time (seconds) of data stored in cache. A 0 value means "never expire". If the exptime is more than 30 days then Memcached interprets it as UNIX timestamp for expiration.
- bytes - This is the length of the data in bytes that needs to be stored in Memcached.
- value - It is the data that needs to be stored. The data needs to be given on the new line after executing the command with the above options.

```
// bytes 要和value的character数目完全一样
set bittiger 0 900 9
memcached

get bittiger
```

### Add Data
Memcached `add` command is used to set a value to a new key. If the key already exists, then it gives the output NOT_STORED.

```
add key flags exptime bytes
value
```

### Replace Data
Memcached `replace` command is used to replace the value of an existing key.

```
replace key flags exptime bytes

```

### Append/Prepend
Memcached `append/prepend` command is used to add data in an existing key. This data is added at the `start/end` of the previous value.

```
append key flags exptime bytes
```

### CAS (Check-And-Set)
Memcached CAS command 'checks' and 'set' data item if and only if, no other client process has updated it since last read by this client. The `unique_cas_token` is obtained from the `gets` command.
[Reference](https://www.tutorialspoint.com/memcached/memcached_cas.htm)

```
cas key flags exptime bytes unique_cas_token
```

## Retrieval Commands
### Get
```
get key1 key2 key3
```
### Gets
Memcached gets command is used to get the value with CAS token.

```
gets key1 key2 key3
```

### Delete
```
delete key
```

### Incr/Decr

## Statistics Commands

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

この issue には memcached のコマンドラインと保存/取得に関するメモが含まれていますが、リポジトリ内のファイル、テスト、ドキュメントのエントリーポイントのいずれも指定されていません。まずプロジェクトのドキュメントがどこで管理されているかを特定する必要があります。この資料を適切な場所に配置し、そのコマンドと説明が正確かつ完全であることを検証すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
memcached
領域
cli, documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。