public static function getDataCacheKey($data, Context $context)
    {
        $group = $context->hasAttribute('groups') ? $context->getAttribute('groups') : '*';
        $version = $context->hasAttribute('version') ? $context->getAttribute('version') : '*';

        $dataArray = [
            'data' => $data,
            'serializationFormat' => $context->getFormat(),
            'serializationGroups' => $group,
            'serializationVersion' => $version,
        ];

        try {
            return \sha1(\serialize($dataArray));
        } catch (\Exception $e) {
            return;
        }
    }
public static function getDataCacheKey($data, Context $context)
    {
        $group = $context->hasAttribute('groups') ? $context->getAttribute('groups') : '*';
        $version = $context->hasAttribute('version') ? $context->getAttribute('version') : '*';

        $dataArray = [
            'data' => $data,
            'serializationFormat' => $context->getFormat(),
            'serializationGroups' => $group,
            'serializationVersion' => $version,
        ];

        try {
            return \sha1(\serialize($dataArray));
        } catch (\Exception $e) {
            return;
        }
    }
public static function getDataCacheKey ( $ data , Context $ context ) { $ group = $ context -> hasAttribute ( 'groups' ) ? $ context -> getAttribute ( 'groups' ) : '*' ; $ version = $ context -> hasAttribute ( 'version' ) ? $ context -> getAttribute ( 'version' ) : '*' ; $ dataArray = [ 'data' => $ data , 'serializationFormat' => $ context -> getFormat ( ) , 'serializationGroups' => $ group , 'serializationVersion' => $ version , ] ; try { return \ sha1 ( \ serialize ( $ dataArray ) ) ; } catch ( \ Exception $ e ) { return ; } }
Returns the caching key of the given data or null if it can not be cached.

@param $data
@param Context $context

@return null|string
Returns the caching key of the given data or null if it can not be cached .