363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
}
fossil_print("max-cache-entry: %d\n", db_get_int("max-cache-entry",10));
}else{
fossil_fatal("Unknown subcommand \"%s\"."
" Should be one of: clear init list size status", zCmd);
}
}
/*
** WEBPAGE: cachestat
**
** Show information about the webpage cache. Requires Setup privilege.
*/
void cache_page(void){
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
}
fossil_print("max-cache-entry: %d\n", db_get_int("max-cache-entry",10));
}else{
fossil_fatal("Unknown subcommand \"%s\"."
" Should be one of: clear init list size status", zCmd);
}
}
/*
** Given a cache key, find the check-in hash and return it as a separate
** string. The returned string is obtained from fossil_malloc() and must
** be freed by the caller.
**
** Return NULL if not found.
**
** The key is usually in a format like these:
**
** /tarball/HASH/NAME
** /zip/HASH/NAME
** /sqlar/HASH/NAME
*/
static char *cache_hash_of_key(const char *zKey){
int i;
if( zKey==0 ) return 0;
if( zKey[0]!='/' ) return 0;
zKey++;
while( zKey[0] && zKey[0]!='/' ) zKey++;
if( zKey[0]==0 ) return 0;
zKey++;
for(i=0; zKey[i] && zKey[i]!='/'; i++){}
if( !validate16(zKey, i) ) return 0;
return fossil_strndup(zKey, i);
}
/*
** WEBPAGE: cachestat
**
** Show information about the webpage cache. Requires Setup privilege.
*/
void cache_page(void){
|
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
" FROM cache"
" ORDER BY (tm + 3600*min(nRef,48)) DESC"
);
if( pStmt ){
@ <ol>
while( sqlite3_step(pStmt)==SQLITE_ROW ){
const unsigned char *zName = sqlite3_column_text(pStmt,0);
@ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br />
@ size: %,lld(sqlite3_column_int64(pStmt,1))
@ hit-count: %d(sqlite3_column_int(pStmt,2))
@ last-access: %s(sqlite3_column_text(pStmt,3))</p></li>
}
sqlite3_finalize(pStmt);
@ </ol>
}
zDbName = cacheName();
bigSizeName(sizeof(zBuf), zBuf, file_size(zDbName, ExtFILE));
@ <p>
|
>
|
>
>
>
>
>
>
|
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
" FROM cache"
" ORDER BY (tm + 3600*min(nRef,48)) DESC"
);
if( pStmt ){
@ <ol>
while( sqlite3_step(pStmt)==SQLITE_ROW ){
const unsigned char *zName = sqlite3_column_text(pStmt,0);
char *zHash = cache_hash_of_key((const char*)zName);
@ <li><p>%z(href("%R/cacheget?key=%T",zName))%h(zName)</a><br />
@ size: %,lld(sqlite3_column_int64(pStmt,1))
@ hit-count: %d(sqlite3_column_int(pStmt,2))
@ last-access: %s(sqlite3_column_text(pStmt,3)) \
if( zHash ){
@ %z(href("%R/timeline?c=%S",zHash))check-in</a>\
fossil_free(zHash);
}
@ </p></li>
}
sqlite3_finalize(pStmt);
@ </ol>
}
zDbName = cacheName();
bigSizeName(sizeof(zBuf), zBuf, file_size(zDbName, ExtFILE));
@ <p>
|