From aea3ac7e69b9aa0c21108105fc4de0a0e6878e31 Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Tue, 27 Sep 2016 19:43:45 +0300 Subject: [PATCH 1/1] =?utf8?q?=D0=9A=D0=B5=D1=88=D0=B8=D1=80=D0=BE=D0=B2?= =?utf8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B3=D0=B5=D0=BD=D0=B5=D1=80?= =?utf8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=84?= =?utf8?q?=D1=80=D0=B0=D0=B7=20=D0=B2=20Redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- festival-php/voice_class_inc.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/festival-php/voice_class_inc.php b/festival-php/voice_class_inc.php index 5f49c36..b5ef032 100644 --- 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 ''; -- 2.34.1