Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache expression #16

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

devrck
Copy link
Contributor

@devrck devrck commented Dec 27, 2016

No description provided.

@coveralls
Copy link

coveralls commented Dec 27, 2016

Coverage Status

Coverage decreased (-0.1%) to 93.75% when pulling 0c8645c on devrck:cache-expression into bf9c1ae on eMAGTechLabs:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 93.75% when pulling 0c8645c on devrck:cache-expression into bf9c1ae on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 93.75% when pulling 0c8645c on devrck:cache-expression into bf9c1ae on eMAGTechLabs:master.

@@ -14,7 +14,8 @@
"ocramius/proxy-manager": "2.*",
"psr/log": "1.*",
"psr/cache": "1.0.*",
"doctrine/annotations": "1.3.*"
"doctrine/annotations": "1.3.*",
"symfony/expression-language": "3.*"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expression-language can be put as suggested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you put it as suggested you can't use @CacheExpression annotation I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can put it in both require-dev (so you can test it) and in suggests.
Who requires usage of expression should include the package explictly

}

$this->expressionLanguage = new ExpressionLanguage(new FilesystemAdapter('expr_cache'));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we convert this into service based? This way it will be easier if someone wants to use anything else here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your talkin' about the new FilesystemAdapter?

Copy link
Contributor

@alexbumbacea alexbumbacea Dec 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but also maybe classes that extend the base ExpressionLanguage...

public function calculateCachePrefix() : string
{
return 'xyz';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also update the readme ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I will.

Bogdan Rancichi added 4 commits January 3, 2017 21:40
@coveralls
Copy link

coveralls commented Jan 3, 2017

Coverage Status

Coverage decreased (-98.3%) to 0.0% when pulling 48aea7e on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-98.3%) to 0.0% when pulling 48aea7e on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

coveralls commented Jan 7, 2017

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling 6196890 on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling 6196890 on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling 6196890 on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling 6196890 on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling 6196890 on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

coveralls commented Jan 7, 2017

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling ac8f56a on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling ac8f56a on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling ac8f56a on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling ac8f56a on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 99.01% when pulling ac8f56a on devrck:cache-expression into 75aa68b on eMAGTechLabs:master.


$expressionLanguage = new \ReflectionClass($container->getDefinition($config['expression_language'])->getClass());
if ($expressionLanguage->getName() !== ExpressionLanguage::class) {
throw new CacheException(sprintf('You must provide a valid Expression Language service'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too exact class match. You should be able to provide anything that extends expressionLanguage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course I will fix it.

'emag.cache.expression.language'=> (new Definition(ExpressionLanguage::class))->addArgument(new Reference('emag.cache.filesystem.adapter')),
]);
} elseif ($config['expression_language']) {
$container->setAlias('emag.cache.expression.language', $config['expression_language']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would reverse the if. it's cheaper... :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@@ -23,6 +25,8 @@
*/
protected $readerForCacheMethod;

protected $__expressionLanguage;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's with the __ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid parameter collision.

@danieltoader
Copy link
Member

Will take a look into it, but it requires a few changes to be included in the new version with the refactor done for v5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants