예제 #1
0
    public async Task <IReadOnlyCollection <Vacancy> > GetHotVacancies()
    {
        var       key  = $"hot_vacancies";
        const int size = 5;

        var result = _cache.Get(key) as IReadOnlyCollection <Vacancy>;

        if (result == null)
        {
            result = await _repository.GetHotVacancies(size);

            _cache.Set(key, result, GetMemoryCacheEntryOptions());
        }

        return(result);
    }