C#超时后自动释放锁定 [英] C# release lock automatically after timeout

查看:741
本文介绍了C#超时后自动释放锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人对实现锁的最佳方法有什么想法,以便在X秒钟后将其自动释放吗?

does anyone have any ideas on whats the best way to implement a lock so that after X number of seconds it will automatically be released ?

推荐答案

在Web开发中,我一直在缓存滑动超时.也许您可以将缓存的对象用作锁?

In web development, I cache all the time with a sliding timeout. Perhaps you could use a cached object as the lock?

这里讨论非Web应用程序中的缓存技术:

Here's a discussion of caching technologies in non-web applications:

在没有System.Web的C#中进行缓存

这篇关于C#超时后自动释放锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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