Package quickdb.modelSupport

Examples of quickdb.modelSupport.CacheManager


        return false;
    }

    public ArrayList obtainCache(String sql, AdminBase admin, Class clazz){
        if(this.cacheStore.containsKey(clazz.getName() + sql)){
            CacheManager cache = this.cacheStore.get(clazz.getName() + sql);
            switch(cache.getCacheType()){
                case 0:
                    return cache.getData();
                case 1:
                    CacheManager cacheUpdate = new CacheManager();
                    admin.setCollectionHasName(true);
                    this.nameCollection.push(cache.getTableName());
                    admin.obtainWhere(cacheUpdate, "id > 0");
                    admin.setCollectionHasName(false);
                    if(cacheUpdate.getId() == cache.getId()){
                        return cache.getData();
                    }
                    this.cacheStore.remove(clazz.getName() + sql);
                    return admin.obtainAll(clazz, sql);
            }
View Full Code Here


        return null;
    }

    public void makeCacheable(String sql, ArrayList array, Class clazz, AdminBase admin){
        CacheManager cache = new CacheManager(array);
        Annotation entity[] = clazz.getAnnotations();
        for (int i = 0; i < entity.length; i++) {
            if (entity[i] instanceof Table){
                if(((Table)entity[i]).cache()){
                    cache.setCacheType(0);
                }else if(((Table)entity[i]).cacheUpdate()){
                    cache.setCacheType(1);
                    cache.setTableName(clazz.getSimpleName() + "CacheUpdate");
                    admin.setCollectionHasName(true);
                    this.nameCollection.push(cache.getTableName());
                    admin.obtainWhere(cache, "id > 0");
                    admin.setCollectionHasName(false);
                }
                break;
            }
View Full Code Here

        Annotation entity[] = clazz.getAnnotations();
        for (int i = 0; i < entity.length; i++) {
            if (entity[i] instanceof Table){
                if(((Table)entity[i]).cacheUpdate()){
                    String tableName = clazz.getSimpleName() + "CacheUpdate";
                    CacheManager cacheUpdate = new CacheManager();
                    if(admin.checkTableExist(tableName)){
                        admin.executeQuery("DELETE FROM " + tableName);
                    }
                    admin.setForceTable(true);
                    admin.setTableForcedName(tableName);
View Full Code Here

TOP

Related Classes of quickdb.modelSupport.CacheManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.