src/OrchardCore.Modules/OrchardCore.Shortcodes/Services/ShortcodeTemplatesManager.cs
/// <summary>
/// Returns the document from the cache or creates a new one. The result should not be updated.
/// </summary>
Returns the document from the cache or creates a new one. The result should not be updated.
Returns the document from the cache or creates a new one . The result should not be updated .
public async Task<ShortcodeTemplatesDocument> GetShortcodeTemplatesDocumentAsync()
        {
            if (!_memoryCache.TryGetValue<ShortcodeTemplatesDocument>(CacheKey, out var document))
            {
                var changeToken = ChangeToken;
                bool cacheable;
                (cacheable, document) = await _sessionHelper.GetForCachingAsync<ShortcodeTemplatesDocument>();
                if (cacheable)
                {
                    foreach (var template in document.ShortcodeTemplates.Values)
                    {
                        template.IsReadonly = true;
                    }
                    _memoryCache.Set(CacheKey, document, changeToken);
                }
            }
            return document;
        }
public async Task < ShortcodeTemplatesDocument > GetShortcodeTemplatesDocumentAsync ( ) { if ( ! _memoryCache . TryGetValue < ShortcodeTemplatesDocument > ( CacheKey , out var document ) ) { var changeToken = ChangeToken ; bool cacheable ; ( cacheable , document ) = await _sessionHelper . GetForCachingAsync < ShortcodeTemplatesDocument > ( ) ; if ( cacheable ) { foreach ( var template in document . ShortcodeTemplates . Values ) { template . IsReadonly = true ; } _memoryCache . Set ( CacheKey , document , changeToken ) ; } } return document ; }
Returns the document from the cache or creates a new one.
Returns the document from the cache or creates a new one .