hackjutsu / hackjutsu/memcached-java-demo

memcached 命令行

Đang mở
#1 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Issue chứa các ghi chú về dòng lệnh và việc lưu trữ/truy xuất của memcached nhưng không nêu tệp, bài kiểm thử hoặc điểm vào tài liệu nào trong repository. Trước tiên, cần xác định tài liệu của dự án được duy trì ở đâu; công việc được xem là hoàn tất khi đặt nội dung này vào vị trí phù hợp và xác minh rằng các lệnh cùng phần giải thích của nó chính xác và đầy đủ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
memcached
Lĩnh vực
cli, documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.