Problems with creating tables for beginners in redis

WBOY
Release: 2016-08-04 09:21:45
Original
2278 people have browsed it

Assume that there is currently a mysql table article structure of
id
title title
info content
tags tag id collection
status status (-1, 0, 1, 2)
atime addition time
utime update time
ptime release time
demand press (Tag/Status) Get articles sorted by (add/update/publish) time
How should the redis table be designed at this time?
The current idea is
string type
article:title:{id}
article:info:{id}
article:tags:{id}
article:status:{id}
article:atime:{id}
article :utime:{id}
article:ptime:{id}
set type
all collections: article:list
store collections separately according to status: article:status:{-1/0/1/2}
store separately according to tags Collection article:tag:{tag_id}

Use something like sort article:tag:1 by article:atime:* to get sorting. Is this design reasonable?

There is another question. When trying to search, use
zrangebylex article:status:0 [f (g
The result is an error
ERR unknown command 'zrangebylex'
What is the reason?

Reply content:

Assume that there is currently a mysql table article structure of
id
title title
info content
tags tag id collection
status status (-1, 0, 1, 2)
atime addition time
utime update time
ptime release time
demand press (Tag/Status) Get articles sorted by (add/update/publish) time
How should the redis table be designed at this time?
The current idea is
string type
article:title:{id}
article:info:{id}
article:tags:{id}
article:status:{id}
article:atime:{id}
article :utime:{id}
article:ptime:{id}
set type
all collections: article:list
store collections separately according to status: article:status:{-1/0/1/2}
store separately according to tags Collection article:tag:{tag_id}

Use something like sort article:tag:1 by article:atime:* to get sorting. Is this design reasonable?

There is another question. When trying to search, use
zrangebylex article:status:0 [f (g
The result is an error
ERR unknown command 'zrangebylex'
What is the reason?

zrangebylex requires redis >= 2.8.9

sort article:tag:1 by article:atime:* This sentence is to get the sorting of article ids with tag 1 by adding time, right? This design works

String type is not recommended as it will cause too many keys

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template