Memcached - 删除键17 Mar 2025 | 阅读 2 分钟 Memcached 的 delete 命令用于从 Memcached 服务器删除现有的键。 这意味着如果缓存中存在该项,则将其删除。 语法此处, key: 这是存储在 Memcached 中并从中检索的数据键。 noreply: 这是一个可选参数。 它用于通知服务器不发送任何回复。 返回值此命令将返回以下值 DELETED: 表示成功删除。 ERROR: 表示删除数据时出错或语法错误。 NOT_FOUND: 表示键在 Memcached 服务器中不存在。 Ubuntu 中的示例让我们看一个删除命令的例子。 这里我们将使用 'city' 作为键,并将 'bangalore' 存储在其中,过期时间为 900 秒。 之后,使用 delete 命令删除键 'city'。 ![]() Windows 中的示例Memcached 服务器 ![]() Memcached 客户端 ![]() 使用 Java 应用程序删除数据假设 Memcached 服务器在主机 127.0.0.1 和端口 11211 上运行。 在这里,我们将使用 delete() 方法从 Memcached 服务器删除数据。 示例 1输出 Connection to server successful set status: true Get from Cache: Bangalore Delete from Cache: true Get from Cache: null 示例 2输出 Connection to server successful set status:true javatpoint value in cache - largest online tutorials library delete status:true javatpoint value in cache - null 下一主题# |
我们请求您订阅我们的新闻通讯以获取最新更新。