Comments (7)
@umbri What's the logic you implemented? I guess you can just use eval
directly now?
It does implement the API, just not totally low-level.
from redis.
@kelunik I understand that this is a feature, but for me I need that old evalSha(), as I say I have some old code that was ported from another language with a lot of tests and using old evalSha() all was fine, now I get error, I understand that I can rewrite it but I think there may be other one as me, I suggest to just mark it as @deprecated
and not trigger_error()
from redis.
If you don't want to get deprecation warnings, you can exclude them in your error reporting setting or explicitly silence your call to evalSha
.
We could maybe talk about not deprecating it at all, but given that it newer worked correctly, I don't see a lot of advantage in that.
from redis.
I am worry of this extra call for sha1()
https://github.com/amphp/redis/blob/master/lib/Redis.php#L1923
I am calling evalSha()
very often, 90% off all calls to Redis
from redis.
We could optimize that and include a lookup cache.
<?php
$cache = [];
function bench(string $script) {
global $cache;
// version without cache: return \sha1($script);
if (isset($cache[$script])) {
return $cache[$script];
}
$sha1 = \sha1($script);
$cache[$script] = $sha1;
return $sha1;
}
$start = \microtime(true);
for ($i = 0; $i < 1000000; $i++) {
bench("foobar = foobar = foobar = foobar = foobar;");
}
var_dump(\microtime(true) - $start);
kelunik@kelunik ❯ ~ ❯ 18:12:25 ❯
$ php test.php # with cache
float(0.05865216255188)
kelunik@kelunik ❯ ~ ❯ 18:12:38 ❯
$ php test.php # without cache
float(0.33159995079041)
from redis.
from redis.
Closing, as https://github.com/amphp/redis/releases/tag/v0.3.3 has been released with a script cache.
from redis.
Related Issues (20)
- Initial connect failure does not allow reuse of object
- getMultiple method doesn't work HOT 4
- Subscriber and publisher are leaking open files HOT 2
- Redis Stack Support HOT 3
- Problem with redis connection HOT 1
- Missing commands HOT 5
- Minor bug with getName()
- TypeError, Amp\Redis\Redis::set(): Return value must be of type bool, null returned HOT 1
- Update documentation
- Check non-final classes HOT 1
- 1.x RemoteExecutor#143 Call to a member function fail() on null
- example for pubsub? HOT 3
- Suggestion: replace league/uri-parser for league/uri
- Crash when using RedisMap::getValue on hash where field does not exist
- Wrong behavior on single subscription unsubscribe
- Add RESP3 support
- Add transactions support
- Add support for sorted sets HOT 1
- Add support for lists HOT 1
- `increment()` fails in a transaction HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis.