projects
/
php.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
06edffc
)
Кеширование сгенерированных фраз в Redis
master
author
Roman Bazalevsky
<rvb@rvb.name>
Tue, 27 Sep 2016 16:43:45 +0000
(19:43 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Tue, 27 Sep 2016 16:43:45 +0000
(19:43 +0300)
festival-php/voice_class_inc.php
patch
|
blob
|
history
diff --git
a/festival-php/voice_class_inc.php
b/festival-php/voice_class_inc.php
index 5f49c36ee2d93cc46a4c38783514962c43a9b7fd..b5ef032ef9e28560ca39961327c1a3eb7e1cc1ac 100644
(file)
--- a/
festival-php/voice_class_inc.php
+++ b/
festival-php/voice_class_inc.php
@@
-12,7
+12,15
@@
class voice
function text2Wav($string,$lang = "ru")
{
- print_r($this);
+ $redis = new Redis();
+ $hash ='';
+ if ($redis->pconnect('127.0.0.1', 6379, 2.5)) {
+ $hash="voice-".hash("sha256","$lang-$string");
+ $result=$redis->get($hash);
+ if ($result) {
+ return $result;
+ }
+ }
if ($this->mode == 'festival') {
@@
-48,6
+56,9
@@
class voice
}
if (!$proc_result) {
+ if ($hash) {
+ $redis->set($hash,$data);
+ }
return $data;
} else {
return '';