コード例 #1
0
ファイル: UserService.cs プロジェクト: lob94/Mad
        public int CountFindGroupsByKeywords(string name)
        {
            String          clave  = "CountFindGroup" + name;
            CacheItemPolicy policy = new CacheItemPolicy();

            policy.AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(5.0);
            object cacheCountGroups = (object)cache.Get(clave);
            int    countGroups;

            if (cacheCountGroups == null)
            {
                String[] keywords = name.Split(' ');
                countGroups = GroupDao.CountFindGroupsByName(keywords);
                cache.Add(clave, countGroups, policy);
            }
            else
            {
                countGroups = (int)cacheCountGroups;
            }

            return((int)countGroups);
        }