예제 #1
0
        public static UrlCache GetUrlCache()
        {
            UrlCache urlCache = null;

            if (__useUrlCache)
            {
                //urlCache = new UrlCache_new(__cacheDirectory, __urlFileNameType, (url, requestParameters) => (Ebookdz_LoadPostDetailFromWebManager.GetPostDetailKey(url) / 1000 * 1000).ToString());
                urlCache = new UrlCache(__cacheDirectory);
                urlCache.UrlFileNameType            = __urlFileNameType;
                urlCache.GetUrlSubDirectoryFunction = httpRequest => (Ebookdz_LoadPostDetailFromWebManager.GetPostDetailKey(httpRequest) / 1000 * 1000).ToString();
            }
            return(urlCache);
        }
예제 #2
0
        public static void ClassInit(XElement xe)
        {
            __useUrlCache    = xe.zXPathValue("UseUrlCache").zTryParseAs(false);
            __cacheDirectory = xe.zXPathValue("CacheDirectory");

            __useMongo              = xe.zXPathValue("UseMongo").zTryParseAs(__useMongo);
            __mongoServer           = xe.zXPathValue("MongoServer", __mongoServer);
            __mongoDatabase         = xe.zXPathValue("MongoDatabase");
            __mongoCollectionName   = xe.zXPathValue("MongoCollection");
            __mongoDocumentItemName = xe.zXPathValue("MongoDocumentItemName");

            if (__useMongo)
            {
                MongoDocumentStore_v3 <int, IPost> mongoDocumentStore = new MongoDocumentStore_v3 <int, IPost>(__mongoServer, __mongoDatabase, __mongoCollectionName, __mongoDocumentItemName);
                mongoDocumentStore.DefaultSort         = "{ 'download.creationDate': -1 }";
                mongoDocumentStore.GetDataKey          = post => post.GetKey();
                mongoDocumentStore.Deserialize         = document => BsonSerializer.Deserialize <Ebookdz_PostDetail>(document);
                __currentLoadPostDetail._documentStore = mongoDocumentStore;
            }
            __loadPostDetailFromWebManager = new Ebookdz_LoadPostDetailFromWebManager(GetUrlCache());
            //__currentLoadPostDetail._loadWebDataManager = new LoadWebDataManager_new2<int, IPost>(new Ebookdz_LoadPostDetailFromWebManager(GetUrlCache()), __currentLoadPostDetail._documentStore);
            __currentLoadPostDetail._loadWebDataManager       = new LoadWebDataManager_v5 <int, IPost>(__loadPostDetailFromWebManager, __currentLoadPostDetail._documentStore);
            __currentLoadPostDetail._loadEnumDataPagesFromWeb = Ebookdz_LoadHeaderPagesManager.CurrentLoadHeaderPagesManager;
        }
예제 #3
0
 protected override int GetKeyFromHttpRequest(HttpRequest httpRequest)
 {
     return(Ebookdz_LoadPostDetailFromWebManager.GetPostDetailKey(httpRequest));
 }