public function onData($data)
 {
     if ($this->digest !== null) {
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($this->serviceName, $this->param);
         $store->storeData($this->digest, $ext, com_wiris_system_Utf8::toBytes($data));
     }
     $this->response->returnString($data);
 }
 public function service($serviceName, $param)
 {
     $digest = null;
     if (com_wiris_plugin_impl_TextServiceImpl::hasCache($serviceName)) {
         $digest = $this->plugin->newRender()->computeDigest(null, $param);
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $s = $store->retreiveData($digest, $ext);
         if ($s !== null) {
             return com_wiris_system_Utf8::fromBytes($s);
         }
     }
     $url = $this->plugin->getImageServiceURL($serviceName);
     $h = new com_wiris_plugin_impl_HttpImpl($url, null);
     $this->plugin->addReferer($h);
     $this->plugin->addProxy($h);
     if ($param !== null) {
         $ha = com_wiris_system_PropertiesTools::fromProperties($param);
         $iter = $ha->keys();
         while ($iter->hasNext()) {
             $k = $iter->next();
             $h->setParameter($k, $ha->get($k));
             unset($k);
         }
     }
     $h->request(true);
     $r = $h->getData();
     if ($digest !== null) {
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $store->storeData($digest, $ext, com_wiris_system_Utf8::toBytes($r));
     }
     return $r;
 }
 public function service($serviceName, $param)
 {
     $digest = null;
     if (com_wiris_plugin_impl_TextServiceImpl::hasCache($serviceName)) {
         $digest = $this->plugin->newRender()->computeDigest(null, $param);
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $s = $store->retreiveData($digest, $ext);
         if ($s !== null) {
             return com_wiris_system_Utf8::fromBytes($s);
         }
     }
     $result = $this->serviceText($serviceName, $param);
     if ($digest !== null) {
         $store = $this->plugin->getStorageAndCache();
         $ext = com_wiris_plugin_impl_TextServiceImpl::getDigestExtension($serviceName, $param);
         $store->storeData($digest, $ext, com_wiris_system_Utf8::toBytes($result));
     }
     return $result;
 }