Esempio n. 1
0
function replaceImgURL($content)
{
    return str_replace('static.cnbetacdn.com', 'cnbeta1.sinaapp.com', $content);
}
# App shutdown
App::shutdown(function () {
    Cacher::close();
});
# Constants
const ARTICLE_CACHE_TIME = 1814400;
// 3600 * 24 * 21, 21 days
const ARTICLE_REFRESH_TIME = 300;
// 5min
const ARTICLE_RECENT_DAY = 2;
// article in 1 day is 'recent'
# For cache keys
const ARTICLE_CACHE_KEY_PREFIX = 'A:';
const UPTODATE_KEY_PREFIX = 'U:';
const LATEST_ARTICLE_ID_KEY = 'LatestArticle';
const INDEX_CACHE_KEY = 'IndexData';
const FEED_CACHE_KEY = 'FeedData';
# Index Page
const INDEX_ARTICLE_NUM = 20;
const INDEX_EXPIRE_TIME = 180;
// 3min
# Feed
const FEED_EXPIRE_TIME = 86400;
// 1 day
# Init Cache Engine
Cacher::setCacher(new RedisCacher());