首页 \ 问答 \ memcache页面可以更改slab类吗?(Can a memcache page change slab class?)

memcache页面可以更改slab类吗?(Can a memcache page change slab class?)

我试图了解memcached内存模型是如何工作的。

如果指定页面中的所有项目已过期或已被删除,该页面是否可以标记为未分配(并稍后迁移到另一个板块类别)? 也就是说,假设我用大量1KB的对象填满了我的memcached实例,并且过期时间为24小时。 48小时后,我写了大量的512 kb条目(不同的平板类),1 kb平板类的页面会慢慢取消分配吗?

如果是这种情况,最佳做法应该是始终为所有对象设置到期时间。


I'm trying to understand how memcached memory model works.

If all items in an assigned page have expired or been deleted, can that page be marked as unassigned (and later migrate to another slab class)? That is, let's say I fill up my memcached instance with lots of 1 kb objects with an expiry of 24 hours. 48 hours later, I write lots of 512 kb items (different slab class), will the 1 kb slab class pages slowly get unassigned?

If this is the case, best practise should be to always set an expiry time for all objects.


原文:https://stackoverflow.com/questions/43374827
更新时间:2021-11-21 17:11

最满意答案

你也可以使用下面的方法来启动和停止主线程中的活动指示符,并且还提供了异步执行你的代码的方法,

- (void)showIndicatorAndStartWork
{
    // start the activity indicator (you are now on the main queue)
    [activityIndicator startAnimating];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        // do your background code here

        dispatch_sync(dispatch_get_main_queue(), ^{
            // stop the activity indicator (you are now on the main queue again)  
        [activityIndicator stopAnimating];
        });
    });
}

You can also use the below method which starts and stops the activity indicator on main thread in a single method, also provides you to execute your code asynchronously as well-

- (void)showIndicatorAndStartWork
{
    // start the activity indicator (you are now on the main queue)
    [activityIndicator startAnimating];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        // do your background code here

        dispatch_sync(dispatch_get_main_queue(), ^{
            // stop the activity indicator (you are now on the main queue again)  
        [activityIndicator stopAnimating];
        });
    });
}

相关问答

更多
  • 试试这个: let activityIndicator = UIActivityIndicatorView.init(activityIndicatorStyle:UIActivityIndicatorViewStyle.WhiteLarge) self.view.addSubview(activityIndicator) // Switch To Background Thread dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIOR ...
  • 介绍completedItems:变量。 某些功能下载完成后,您可以增加该功能。 每次完成后调用停止活动功能,如下所示: - var completedItems:Int = 0 func getDataFromDatamanager() { DataManager.getGoldPriceFromQuandlWithSuccess { (QuandlGoldPrice) -> Void in let json = JSON(data: QuandlGoldPrice) if let da ...
  • 你的indicadorDeAtividade.center不正确。 UIView的center属性使用UIView的坐标系,因此您已将活动指示器放在屏幕外。 在函数configurarIndicadorDeAtividade ,替换: indicadorDeAtividade.center = loadingView.center 有: indicadorDeAtividade.center = CGPointMake(loadingView.frame.width / 2, loadingView.fr ...
  • 一个建议尝试这样: - (IBAction)forgotPassword:(id)sender { [self->thinkingIndicator startAnimating]; [NSThread detachNewThreadSelector: @selector(requestNewPassword:) toTarget:self withObject:userEmail.text]; } - (void) requestNewPassword:(NSString *)email ...
  • 如果所有代码都在一个方法中,或者对一个事件作出响应,那么在您返回到事件循环之前,没有任何对视图的更改会显示出来。 您可以将activityIndicator.hidden设置为NO,然后在UI有机会刷新之前再次将其设置为YES。 在开始之前,您显然也停止了动画。 你需要做的是使活动指示器在这里可见并开始其动画。 然后计划完成工作(启动一个异步网络连接,或者将一些工作放入队列中,或者无论您需要做什么),然后从此方法返回以便UI可以刷新,可以绘制指标,而动画实际上可以开始。 然后在工作完成后的某个时间点,您可以 ...
  • 你也可以使用下面的方法来启动和停止主线程中的活动指示符,并且还提供了异步执行你的代码的方法, - (void)showIndicatorAndStartWork { // start the activity indicator (you are now on the main queue) [activityIndicator startAnimating]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIOR ...
  • 最简单的方法是在实例化UIWebView之后添加此行。 [webView setDelegate:self]; 现在您将调用webViewDidFinishLoad:整个方法应如下所示。 - (void)webViewDidFinishLoad:(UIWebView *)webView { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; } 我将进一步解释这一点,因为您将来绝对需要了解授权。 U ...
  • 动画块中的alpha值始终设置为0.0。 尝试 self.actvityPanel.alpha = (on) ? 1.0 : 0.0 the alpha value is always set to 0.0 in the animation block. Try self.actvityPanel.alpha = (on) ? 1.0 : 0.0
  • 我在主线程中添加了指标代码并且出现了。 我要求一些高级开发人员解释没有它会出现什么问题以及为什么现在它正在发挥作用。 这将有助于未来的未来。 override func viewDidLoad() { super.viewDidLoad() if self.revealViewController() != nil { menuButton.target = self.revealViewController() ...
  • 我会推荐像这样的扩展。 extension UIViewController { func displayNavBarActivity() { let indicator = UIActivityIndicatorView(activityIndicatorStyle: .White) indicator.startAnimating() let item = UIBarButtonItem(customView: indicator) ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)