latest (get_board_files_db) 함수 한 페이지에서 여러번 호출

· 2023-11-02 (목) 00:48:34 · 3096 · 2

latest함수에는 캐시 기능이 있어서 한 페이지에서 여러번 출력이 안되는 경우가 있습니다.

 

latest함수를 보면 캐시값을 만드는 변수는 아래와 같습니다.

    if(G5_USE_CACHE) {
        $cache_file_name = "latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}-".g5_cache_secret_key();
        $caches = g5_get_cache($cache_file_name, (int) $time_unit * (int) $cache_time);
        $cache_list = isset($caches['list']) ? $caches['list'] : array();
        g5_latest_cache_data($bo_table, $cache_list);
    }

이부분 : $cache_file_name = "latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}-".g5_cache_secret_key();

한 페이지에서 여러번 호출하고 싶다면 위 부분에 변수를 추가해야 합니다.

예를들어 : $cache_file_name = "latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}-{$separator}-".g5_cache_secret_key();

이를 위해 latest함수에도 매개변수를 포함합니다.

function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='',$separator='')

 

latest 호출시 마지막 매개변수에 각각 다른 인자를 넣어서 호출합니다.

latest(ㅇ,ㅇ,~~~~,'type1');

latest(ㅇ,ㅇ,~~~~,'type2');

--------------------

get_board_files_db 함수도 아래와 같이 추가합니다.

// 게시판 첨부파일 테이블에서 n행을 읽음  
function get_board_files_db($bo_table, $wr_id, $fields='*', $add_where='', $is_cache=false, $cnt=1, $separator='')

$key = md5($bo_table.'|'.$wr_id.$fields.$add_where.$separator);

 

|

댓글 2개

2023-11-02 (목) 08:43:45

감사합니다. ^^

감사합니다.

댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

2,788건
+
제목 글쓴이 날짜 조회
24-01-15 조회 3,684
24-01-14 조회 3,278
24-01-12 조회 3,096
24-01-01 조회 3,922
23-12-25 조회 3,355
23-12-24 조회 3,903
23-12-20 조회 3,063
23-12-19 조회 3,893
23-12-18 조회 2,645
23-12-15 조회 3,504
23-12-08 조회 3,271
23-12-05 조회 4,601
23-12-01 조회 3,463
23-11-26 조회 3,883
23-11-21 조회 4,415
23-11-20 조회 4,368
23-11-19 조회 3,373
23-11-16 조회 3,486
23-11-15 조회 3,310
23-11-15 조회 3,198
23-11-12 조회 4,343
23-11-09 조회 4,494
23-11-02 조회 3,432
23-11-02 조회 3,097
23-10-30 조회 3,663
23-10-23 조회 4,362
23-10-18 조회 3,500
23-10-17 조회 3,038
23-10-07 조회 4,572
23-10-04 조회 3,058