Redis 中的命名空间? [英] Namespaces in Redis?

查看:106
本文介绍了Redis 中的命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Redis 中创建命名空间?

Is it possible to create namespaces in Redis?

据我所知,所有全局命令(计数、全部删除)都适用于所有对象.有没有办法创建子空间,使这些命令在上下文中受到限制?

From what I found, all the global commands (count, delete all) work on all the objects. Is there a way to create sub-spaces such that these commands will be limited in context?

我不想为此设置不同的 Redis 服务器.

I don't want to set up different Redis servers for this purpose.

我认为答案是否",并想知道为什么没有实现这一点,因为它似乎是一个没有太多开销的有用功能.

I assume the answer is "No", and wonder why wasn't this implemented, as it seems to be a useful feature without too much overhead.

推荐答案

一个 Redis 服务器可以处理多个数据库......我认为它默认提供 32 个;您可以使用 -n 选项的 redis-cli shell 脚本命令和连接参数的类似选项或使用 "select()" 方法在其连接对象上.(在这种情况下,.select() 是 Python Redis 模块的方法名称......我认为其他库和接口的名称类似.

A Redis server can handle multiple databases... which are numbered. I think it provides 32 of them by default; you can access them using the -n option to the redis-cli shell scripting command and by similar options to the connection arguments or using the "select()" method on its connection objects. (In this case .select() is the method name for the Python Redis module ... I presume it's named similarly for other libraries and interfaces.

还有一个选项可以控制您在 Redis 服务器守护程序的配置文件中需要多少个单独的数据库.我不知道上限是多少,而且似乎没有办法动态更改它(换句话说,您似乎必须关闭并重新启动服务器才能添加其他数据库).此外,似乎没有办法将这些数据库编号与任何类型的名称相关联,也不会对它们强加单独的 ACLS,甚至不同的密码.当然,Redis 也是无模式的.

There's an option to control how many separate databases you want in the configuration file for the Redis server daemon as well. I don't know what the upper limit would be and there doesn't seem to be a way to dynamically change that (in other words it seems that you'd have to shutdown and restart the server to add additional DBs). Also, there doesn't seem to be an away to associate these DB numbers with any sort of name nor to impose separate ACLS, nor even different passwords, to them. Redis, of course, is schema-less as well.

这篇关于Redis 中的命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆