开发者

Caching by varyByParam WCF service

开发者 https://www.devze.com 2023-03-22 18:55 出处:网络
i have a method which is not a wcf operation, that does the authentication checks how can i cache its results for like 60 sec? and used the cached results if exits on my operation methods and开发者_运

i have a method which is not a wcf operation, that does the authentication checks

how can i cache its results for like 60 sec? and used the cached results if exits on my operation methods and开发者_运维问答 if it doesn't exists execute the method to get the result?

i want to cache this method based on user name and password.

public Autenticate (UserAccount useacc)
{
............
}  


 public class UserAccount
{
string username, passsword, domainname;

}


You can take a look at this link for caching.

And you can use the class as follows.

WCFCache.Current.Insert(username, useacc, DateTime.Now.AddMinutes(1));
//get an item from the cache
user = (UserAccount )WCFCache.Current[username];
0

精彩评论

暂无评论...
验证码 换一张
取 消