import prop from '@tinkoff/utils/object/prop' ; import { Context } from '@tinkoff/request-core' ; import { CACHE } from './constants/metaTypes' ; import defaultCacheKey from './cacheKey' ; export default ( context , cacheKey = defaultCacheKey ) => { let key = prop ( 'key' , context . getInternalMeta ( CACHE ) ) ; if ( ! key ) { key = cacheKey ( context . getRequest ( ) ) ; context . updateInternalMeta ( CACHE , { key , } ) ; } return key ; } ;