Skip to content

为啥执行运行示例,取不到缓存的内容 #80

@RobinGitHub

Description

@RobinGitHub
      public async Task<IActionResult> Index()
       {
           _logger.LogDebug("Executing _memcachedClient.GetValueOrCreateAsync...");
           var cacheSeconds = 2000;
           var posts = await _memcachedClient.GetValueOrCreateAsync(
               CacheKey,
               cacheSeconds,
               async () => await _blogPostService.GetRecent(10));

           _logger.LogDebug("Done _memcachedClient.GetValueOrCreateAsync");

           return Ok(posts);
       }

测试的时候每次都会进入 await _blogPostService.GetRecent(10)); 这个子方法。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions