mysql的标签(tag)是如何储存的?
阿神
阿神 2017-04-17 14:46:34
0
3
978

请看这个页面:https://segmentfault.com/tags
可以看到,标签被分类了。
是否可以根据这个页面,认定segmentfault一定有tag_categorys表?
还是没有tag_category,只是在前端渲染的时候用了一堆堆的if?或者这个页面压根就是静态写的?那又如何反映tag的热门度呢?

阿神
阿神

闭关修行中......

reply all(3)
Ty80

It stores a PHP array

tags.php


return [
    [
        'iOS 开发' => ['ios', 'iphone', 'ipad', 'objective-c', 'sqlite', 'safari'],
         'Android 开发' => ['android', 'java', 'eclipse', 'xml'],
    ],
    [
         '开发语言' =>  ['java', 'c', 'c++', 'php']
    ],
];

Then the data is stored in redis, and user access is to retrieve data from redis.
Of course, it is also possible to put it in MySQL, but these data do not change frequently, and there are many data categories related to tags. Using MySQL requires many tables, so the file management method is currently used.

迷茫

The tag data will eventually be implemented. It should be stored in the MySQL table, and then the frequently used attributes will be cached in redis.

As long as the question is associated with the tag_id, why do you need a tag to associate the issue?

伊谢尔伦

Maybe the redis set is used

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template