首页 \ 问答 \ 相当于Memcached中的Redis哈希?(Equivalent to Redis hashes in Memcached?)

相当于Memcached中的Redis哈希?(Equivalent to Redis hashes in Memcached?)

我正在为我们的应用程序开发一个缓存策略,它使用Redis和Memcached。

我们根据SQL数据库生成相当长的缓存数据JSON字符串。 由于缓存的数据是一次性的,我想使用Memcached,因此它将驱逐我们不再需要的密钥。

问题是可以从不同的参数访问一个集合(例如,用户)。 在Redis中我使用Hash,因此我可以在该哈希中访问集合的每个表示的密钥( hget ),并且仍然能够使用一个命令( del )使所有密钥到期。 但是,我找不到像Memcached那样将旧密钥驱逐到给定DB大小的方法。

所以我的问题是:

  • 如何设置Redis以保持最大数据库大小并根据需要逐出密钥?或
  • 如何在Memcached中模拟Redis哈希值,这样我可以轻松地使一组键过期?

I am working on a caching strategy for our application, which uses both Redis and Memcached.

We generate fairly long JSON strings of cached data, calculated from our SQL database. Since the cached data is disposable, I'd like to use Memcached so it'll evict keys that we don't need anymore.

The problem is that one collection (say, Users), can be accessed from different parameters. In Redis I'd use a Hash, so I could access keys (hget) in that hash for each representation of the collection and still be able to expire all the keys with one command (del). However, I can't find a way to evict old keys to a given DB size like Memcached would do.

So my question is either:

  • How can I set Redis so it keeps a maximum DB size and evicts keys as needed?, or
  • How can I model Redis hashes in Memcached, so I can expire a group of keys easily?

原文:https://stackoverflow.com/questions/11123540
更新时间:2021-07-16 08:07

最满意答案

我使用绝对定位的经验很适合你在大小方面100%控制的元素; 像徽标,meny,rss链接和类似的东西。 然后,您可以将这些元素准确放置在您想要的位置。

当我在页面上显示动态内容时,我更喜欢使用float,因为元素的大小可以改变,并且关系中所有元素的放置对于浮点数非常有用。 只需记住在需要时清除浮子!


I my experience using absolute positioning works well on elements you are in 100% control of in terms of size; like a logo, a meny, rss links and things like this. Then you can place these elements exactly where you want them.

I prefer using float when I am displaying dynamic content on a page, since the size of the element can change, and the placement of all elements in relation works really good with floats. Just remember to clear the floats when needed!

相关问答

更多
  • jsFiddle DEMO 为了在网页底部浮动div,您的容器需要设置为absolute并放在bottom 。 然后,此容器中的所有内容都与您的浮动要求相关。 完成! .media_container { position: absolute; bottom: 0; min-width: 800px; max-height: 800px; min-height: 300px; max-height: 300px; border: 2px solid #f00; } .media_ ...
  • 我可以看到你来自哪里,但使用绝对定位布局是非常不灵活的。 我认为你最好继续使用CSS盒子模型。 这并不是说绝对定位是一件坏事,只是它没有足够的灵活性来处理流体布局,改变盒子尺寸等。 I can see where you're coming from, but using absolute positioning for your layout is extremely inflexible. I think you'd be best to carry on as you are, using the C ...
  • 绝对定位容器的一个大问题是,当您提前知道它们的高度时,将内容放在它们下面的页面上。 在您的示例中,您已经定义了绝对定位元素的高度,因此这对您来说应该不是问题。 如果它适合您,请使用它。 A big problem with absolutely-positioned containers is placing content on the page below them when you don't know their heights ahead of time. In your example you ...
  • 当使用position:fixed您可以通过添加: right: 0或left: 100% (不是两者)来将#nav元素定位到屏幕的right: 0 。 由于您只希望默认情况下可以看到#nav一小部分,因此您可以通过设置负边距将元素“推出屏幕”,例如: #nav { position: fixed; left: 100%; width: 400px; margin-right: -300px; /* (400px-300) keeps 100px of the element ...
  • 如果您愿意改变HTML结构,这将更容易实现。 定位的工作方式是 - 绝对元素将相对于具有位置的最近父母的原始位置position: relative; 所以,我的想法是创建一个部分并在该部分中使用标题元素。 我认为这可能对您自己和便携性更具可读性。 这样你就不会在不同的CSS id之间复制信息。 相反,我利用类来使CSS更加模糊,允许它处理多个元素。
    ...
  • 包裹这个 -
    并添加此CSS #someId { position: relative; width: 0; height: 0; } Wrap this like -
    and add this css #someId { position: ...
  • 做这样的事情: $("#fcf_wraper img").hover( function () { $("div.hover_preview").css({ position: "absolute", left: $(this).offset().left + "px", top: $(thi ...
  • 我使用绝对定位的经验很适合你在大小方面100%控制的元素; 像徽标,meny,rss链接和类似的东西。 然后,您可以将这些元素准确放置在您想要的位置。 当我在页面上显示动态内容时,我更喜欢使用float,因为元素的大小可以改变,并且关系中所有元素的放置对于浮点数非常有用。 只需记住在需要时清除浮子! I my experience using absolute positioning works well on elements you are in 100% control of in terms of ...
  • 如果第一个div具有已知/固定width ,只需将第二个div的left-margin调整为该数量, 小提琴 If the first div has a known / fixed width, simply adjust the left-margin of the second div to that amount, Fiddle
  • 要垂直和水平居中,请添加以下css: margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; http://jsfiddle.net/tfn4t263/ 问题出现了,因为即使你指定了left: 50% ,它也会从div的最左边开始计算...所以你圈子的最左边。 这意味着您的圆圈将显示为向右倾斜。 (适用于IE8以上......如果你想知道的话。) To center vertically and horizontall ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)