日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Redis ??? ?? ????(redis遠程批量刪除)

Redis ??? ?? ????

Redis? ????? ??? ??? ??? ???? NoSQL ????????. Redis? ??? ???? ???? ??? ?? ???? ????. ??? Redis?? ?? ??? ??? ? ??? ??? ? ??.

??? ??? Redis?? ??? ?? ??? ???? ??? ????. ? ???? Python ??? Redis ??? ???? ???? ???? ???? ??? ?? ???.

1. Redis ?? ????

Python ???? Redis ??? ???? ???? redis ??? ???? ??. ??? ???? ???? ??? ????.

“`python

pip install redis


???? Redis ??? ???? ??? ????.

```python
import redis
redis_client = redis.StrictRedis(host='', port=, db=, password='')

2. ?? ??? ?? ???? ????

Redis?? Redis ??? `scan_iter()` ??? ???? Redis ??????? ?? ??? ? ??. ? ??? Redis ??????? ?? ?? ?? ????. ???? ???? ???? ?? ????? ?????.

“`python

def delete_redis_data():

cursor = ‘0’

batch_size = 5000 #batch_size ?? ??? Redis ???? ?? ?? ?? (?? 50 ??? 100).

while cursor != 0:

cursor, keys = redis_client.scan(cursor=cursor, count=batch_size)

if keys:

redis_pipe = redis_client.pipeline()

for key in keys:

redis_pipe.delete(key)

redis_pipe.execute()


3. ?? ?? ????

?? `delete_redis_data()` ??? ???? ?? ??? ??? ? ??.

```python
if __name__ == "__mn__":
delete_redis_data()

4. ???

????? ???? ?????. Redis? ???? ?? `delete_redis_data()` ??? ?????.

“`python

redis_client.set(‘test_key1’, ‘test_value1’)

redis_client.set(‘test_key2’, ‘test_value2’)

delete_redis_data()


`delete_redis_data()` ??? ??? ? Redis ???????? ?? ?? ????? `test_key1`? `test_key2`? ????.

??

Redis?? ??? ?? ??? ??? ? Python ??? ??? ? ??. Redis ??? `scan_iter()` ??? ???? Redis ??????? ????, Python tube ??? ???? Redis ???? ?? ??? ? ??. ?? ?? Redis ???? ???? ????? ? ??.

成都服務(wù)器租用選創(chuàng)新互聯(lián),先試用再開通。
創(chuàng)新互聯(lián)(www.cdcxhl.com)提供簡單好用,價格厚道的香港/美國云服務(wù)器和獨立服務(wù)器。物理服務(wù)器托管租用:四川成都、綿陽、重慶、貴陽機房服務(wù)器托管租用。


本文名稱:Redis ??? ?? ????(redis遠程批量刪除)
文章源于:http://m.5511xx.com/article/dhopeeh.html