Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.14 KB | None | 0 0
  1.  
  2. PHP_FUNCTION(apc_fetch_info) {
  3.     zval *key;
  4.     apc_cache_entry_t* entry;
  5.     apc_cache_key_t slot_key;
  6.     time_t t;
  7.     char *strkey;
  8.     int strkey_len;
  9.     if(!APCG(enabled)) RETURN_FALSE;
  10.  
  11.     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &key) == FAILURE) {
  12.         return;
  13.     }
  14.  
  15.     t = apc_time();
  16.  
  17.     if(Z_TYPE_P(key) != IS_STRING && Z_TYPE_P(key) != IS_ARRAY) {
  18.         convert_to_string(key);
  19.     }
  20.    
  21.     if(Z_TYPE_P(key) == IS_STRING) {
  22.  
  23.         strkey = Z_STRVAL_P(key);
  24.         strkey_len = Z_STRLEN_P(key);
  25.         if(!strkey_len) RETURN_FALSE;
  26.        
  27.         entry = apc_cache_user_find(apc_user_cache, strkey, (strkey_len + 1), t TSRMLS_CC);
  28.         if(!entry) {
  29.             RETURN_FALSE;
  30.         }
  31.  
  32.         apc_cache_make_user_key(&slot_key, strkey, strkey_len + 1, t);
  33.  
  34.         slot_t* slot = apc_cache_find_slot(apc_user_cache, slot_key, t TSRMLS_CC);
  35.         array_init(return_value);
  36.         add_assoc_long(return_value, "ttl", entry->data.user.ttl);
  37. /*
  38.         add_assoc_long(return_value, "num_hits", slot->num_hits);
  39. */
  40.  
  41.     } else if(Z_TYPE_P(key) == IS_ARRAY) {
  42.        
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement