Changeset 851 in svn for trunk/xcache.h


Ignore:
Timestamp:
2012-03-27T16:07:50Z (3 years ago)
Author:
Xuefer
Message:

more readability cache property. reduce memory footprint for data caching

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.h

    r846 r851  
    262262    zend_ulong errors;
    263263    xc_lock_t  *lck;
    264     xc_shm_t   *shm; /* to which shm contains us */
    265     xc_mem_t   *mem; /* to which mem contains us */
     264    xc_shm_t   *shm; /* which shm contains us */
     265    xc_mem_t   *mem; /* which mem contains us */
    266266
    267267    xc_entry_t **entries;
     
    369369/* {{{ xc_entry_data_php_t */
    370370struct _xc_entry_data_php_t {
    371     xc_hash_value_t hvalue; /* hash of md5 */
     371    xc_hash_value_t      hvalue;
    372372    xc_entry_data_php_t *next;
    373     xc_cache_t *cache;      /* which cache it's on */
     373    xc_cache_t          *cache;
    374374
    375375    xc_md5sum_t md5;        /* md5sum of the source */
    376376    zend_ulong  refcount;   /* count of entries referencing to this data */
    377377
    378     size_t sourcesize;
     378    size_t     file_size;
    379379    zend_ulong hits;        /* hits of this php */
    380380    size_t     size;
     
    420420/* {{{ xc_entry_t */
    421421struct _xc_entry_t {
     422    xc_hash_value_t hvalue;
     423    xc_entry_t     *next;
     424    xc_cache_t     *cache;
     425
    422426    xc_entry_type_t type;
    423     xc_hash_value_t hvalue;
    424     xc_entry_t *next;
    425     xc_cache_t *cache;      /* which cache it's on */
    426 
    427     size_t     size;
    428     zend_ulong refcount;    /* count of instances holding this entry */
     427    size_t          size;
     428
     429    time_t     ctime;           /* creation ctime of this entry */
     430    time_t     atime;           /*   access atime of this entry */
     431    time_t     dtime;           /*  deletion time of this entry */
    429432    zend_ulong hits;
    430     time_t     ctime;           /* the ctime of this entry */
    431     time_t     atime;           /* the atime of this entry */
    432     time_t     dtime;           /* the deletion time of this entry */
    433     long       ttl;             /* ttl of time entry, var only */
     433    long       ttl;
    434434
    435435#ifdef IS_UNICODE
     
    440440    union {
    441441        xc_entry_data_php_t *php;
    442         xc_entry_data_var_t *var;
     442        xc_entry_data_var_t var;
    443443    } data;
    444 
    445     time_t mtime;           /* the mtime of origin source file */
     444};
     445
     446typedef struct {
     447    xc_entry_t entry;
     448
     449    zend_ulong refcount;    /* count of php instances holding this entry */
     450    time_t file_mtime;
    446451#ifdef HAVE_INODE
    447     int device;             /* the filesystem device */
    448     int inode;              /* the filesystem inode */
    449 #endif
    450 
    451     /* php only */
     452    int file_device;
     453    int file_inode;
     454#endif
     455
    452456    int    filepath_len;
    453457    ZEND_24(const) char *filepath;
     
    455459    char  *dirpath;
    456460#ifdef IS_UNICODE
     461    int    ufilepath_len;
    457462    UChar *ufilepath;
    458     int    ufilepath_len;
     463    int    udirpath_len;
    459464    UChar *udirpath;
    460     int    udirpath_len;
    461 #endif
    462 
    463 };
     465#endif
     466} xc_entry_php_t;
    464467/* }}} */
    465468
     
    480483/* }}} */
    481484void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC);
    482 void xc_fix_op_array_info(const xc_entry_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC);
     485void xc_fix_op_array_info(const xc_entry_php_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC);
    483486
    484487#endif /* __XCACHE_H */
Note: See TracChangeset for help on using the changeset viewer.