diff --git a/forum/Settings.php b/forum/Settings.php
index 5901918..d64e651 100644
--- a/forum/Settings.php
+++ b/forum/Settings.php
@@ -33,6 +33,9 @@ $sourcedir = '/var/www/rock/forum/Sources';
$webmaster_email = 'noreply@rock.ru'; # Email address to send emails from. (like noreply@yourdomain.com.)
$cookiename = 'SMFCookie10'; # Name of the cookie to set for authentication.
+$mongo_server = "mongodb://rock.home:27017";
+$memcached_host = "127.0.0.1";
+$memcached_port = 11211;
########## Database Info ##########
#$db_server = '127.0.0.1:3306';
$db_server = 'localhost';
@@ -45,4 +48,4 @@ $db_error_send = 1;
$db_last_error = 1353665424;
-?>
\ No newline at end of file
+?>
diff --git a/forum/Sources/Subs.php b/forum/Sources/Subs.php
index 2e7c99d..7b3f5b9 100644
--- a/forum/Sources/Subs.php
+++ b/forum/Sources/Subs.php
@@ -1305,11 +1305,9 @@ function parseVideo($matches) {
}
}
-function parseVideoMyspace($url)
-{
- $ttl = 3600;
- $html = xcache_get($url);
- if ($html !== NULL) {
+function parseVideoMyspace($url) {
+ $html = cache_get($url);
+ if ($html !== FALSE) {
return $html;
}
$page = curl_get(htmlspecialchars_decode($url));
@@ -1326,15 +1324,13 @@ function parseVideoMyspace($url)
$html = 'Посмотреть видео';
$ttl = 60;
}
- xcache_set($url, $html, $ttl);
+ cache_set($url, $html);
return $html;
}
-function parseVideoDailymotion($url)
-{
- $ttl = 3600;
- $html = xcache_get($url);
- if ($html !== NULL) {
+function parseVideoDailymotion($url) {
+ $html = cache_get($url);
+ if ($html !== FALSE) {
return $html;
}
$oembed_endpoint = 'http://www.dailymotion.com/api/oembed';
@@ -1346,22 +1342,23 @@ function parseVideoDailymotion($url)
$html = 'Посмотреть видео';
$ttl = 60;
}
- xcache_set($url, $html, $ttl);
+ cache_set($url, $html);
return $html;
}
-#function xcache_get($param) {
-# return NULL;
-#}
-#
-#function xcache_set($param, $value) {
-# return NULL;
-#}
+function cache_get($param) {
+ global $memcached;
+ return $memcached->get($param);
+}
+
+function cache_set($param, $value, $ttl = 0) {
+ global $memcached;
+ return $memcached->set($param, $value, $ttl);
+}
function parseVideoYoutube($url)
{
- $ttl = 3600;
- $html = xcache_get($url);
- if ($html !== NULL) {
+ $html = cache_get($url);
+ if ($html !== FALSE) {
return $html;
}
$oembed_endpoint = 'http://www.youtube.com/oembed';
@@ -1378,15 +1375,14 @@ function parseVideoYoutube($url)
$html = 'Посмотреть видео';
$ttl = 60;
}
- xcache_set($url, $html, $ttl);
+ cache_set($url, $html);
return $html;
}
function parseVideoVimeo($url)
{
- $ttl = 3600;
- $html = xcache_get($url);
- if ($html !== NULL) {
+ $html = cache_get($url);
+ if ($html !== FALSE) {
return $html;
}
$oembed_endpoint = 'http://www.vimeo.com/api/oembed';
@@ -1398,7 +1394,7 @@ function parseVideoVimeo($url)
$html = 'Посмотреть видео';
$ttl = 60;
}
- xcache_set($url, $html, $ttl);
+ cache_set($url, $html);
return $html;
}
diff --git a/forum/index.php b/forum/index.php
index 2641979..d795d37 100644
--- a/forum/index.php
+++ b/forum/index.php
@@ -75,6 +75,9 @@ if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
$mongodb = new MongoClient();
+$memcached = new Memcached();
+$memcached->addServer($memcached_host, $memcached_port);
+
//
mysql_query("SET NAMES 'utf8'");
setlocale(LC_ALL,"ru_RU.UTF-8");