Changeset ea3648


Ignore:
Timestamp:
02/22/08 20:05:15 (4 years ago)
Author:
Tomash Brechko <tomash.brechko@…>
Branches:
master, ketama-compat
Children:
34f10e
Parents:
4767f2
git-author:
Tomash Brechko <tomash.brechko@…> (02/22/08 20:05:15)
git-committer:
Tomash Brechko <tomash.brechko@…> (02/22/08 20:05:15)
Message:

Add 'namespace' method.

Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • Changes

    rb995a3 rea3648  
    11Revision history for Perl extension Cache::Memcached::Fast. 
     2 
     3 
     40.09  ??? 
     5        - ??? 
     6 
     7        Add method 'namespace' to get and/or set the namespace prefix. 
     8        This is handy when you "lease" C::M::F object for different 
     9        parts of your application that do unrelated things. 
    210 
    311 
  • Fast.xs

    r4767f2 rea3648  
    12301230    OUTPUT: 
    12311231        RETVAL 
     1232 
     1233 
     1234SV * 
     1235namespace(memd, ...) 
     1236        Cache_Memcached_Fast *  memd 
     1237    PROTOTYPE: $;$ 
     1238    PREINIT: 
     1239        const char *ns; 
     1240        size_t len; 
     1241    CODE: 
     1242        ns = client_get_prefix(memd->c, &len); 
     1243        RETVAL = newSVpv(ns, len); 
     1244        if (items > 1) 
     1245          { 
     1246            ns = SvPV(ST(1), len); 
     1247            if (client_set_prefix(memd->c, ns, len) != MEMCACHED_SUCCESS) 
     1248              croak("Not enough memory"); 
     1249          } 
     1250    OUTPUT: 
     1251        RETVAL 
  • MANIFEST

    rcdcc2e rea3648  
    1515t/encoding.t 
    1616t/key_ref.t 
     17t/namespace.t 
    1718t/nowait.t 
    1819t/serialize.t 
  • lib/Cache/Memcached/Fast.pm

    rc028bb rea3648  
    558558 
    559559 
     560=item C<namespace> 
     561 
     562  $memd->namespace(); 
     563  $memd->namespace($string); 
     564 
     565Get and/or set the namespace prefix. 
     566 
     567I<Return:> scalar, the namespace prefix that was in effect before the 
     568call. 
     569 
     570=cut 
     571 
     572# See Fast.xs. 
     573 
     574 
    560575=item C<set> 
    561576 
  • src/client.c

    racf677 rea3648  
    507507 
    508508 
     509const char * 
     510client_get_prefix(struct client *c, size_t *ns_len) 
     511{ 
     512  *ns_len = c->prefix_len - 1; 
     513 
     514  return (c->prefix + 1); 
     515} 
     516 
     517 
    509518static inline 
    510519ssize_t 
  • src/client.h

    rff0698 rea3648  
    115115 
    116116extern 
     117const char * 
     118client_get_prefix(struct client *c, size_t *ns_len); 
     119 
     120extern 
    117121void 
    118122client_set_connect_timeout(struct client *c, int to); 
Note: See TracChangeset for help on using the changeset viewer.