# Where assign values to rrp-\>peers-\>last\_cached?

**URL:** <https://www.ruby-forum.com/t/where-assign-values-to-rrp-peers-last-cached/222515>\
**Category:** NGINX\
**Created:** [August 31, 2012, 9:27am UTC](https://www.ruby-forum.com/t/where-assign-values-to-rrp-peers-last-cached/222515 "2012-08-31T09:27:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 31, 2012, 9:27am UTC](https://www.ruby-forum.com/t/where-assign-values-to-rrp-peers-last-cached/222515/1 "2012-08-31T09:27:46Z")

</div>

Assignment to the variable rrp-\>peers-\>last\_cached cannot be found in  
anywhere in total nginx-1.3.5 source code, if the variable’s default  
value  
is zero, this conditional will never be true:

ngx\_int\_t  
ngx\_http\_upstream\_get\_round\_robin\_peer(ngx\_peer\_connection\_t \*pc, void  
\*data)  
{  
ngx\_http\_upstream\_rr\_peer\_data\_t \*rrp = data;  
…  
if (rrp-\>peers-\>last\_cached) { ==============\>//never be true?

```
    /* cached connection */

    c = rrp->peers->cached[rrp->peers->last_cached];
    rrp->peers->last_cached--;

    /* ngx_unlock_mutex(ppr->peers->mutex); */

```

#if (NGX\_THREADS)  
c-\>read-\>lock = c-\>read-\>own\_lock;  
c-\>write-\>lock = c-\>write-\>own\_lock;  
#endif

```
    pc->connection = c;
    pc->cached = 1;

    return NGX_OK;
}

```

…

i don’t know if i am missing something or not, can anyone help me  
understand  
this? Thank you in advance.

Posted at Nginx Forum:

> **[where assign values to rrp-\>peers-\>last\_cached?](https://forum.nginx.org/read.php?2,230366,230366#msg-230366)**
>
> Assignment to the variable rrp-\>peers-\>last\_cached cannot be found in anywhere in total nginx-1.3.5 source code, if the variable's default value is zero, this conditional will never be true: ngx\_int\_t...

---

<div class="post-metadata">

**Author:** ![lenky0401](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/977dab/32.png) [@lenky0401](https://www.ruby-forum.com/u/lenky0401)\
**Post date:** [August 31, 2012, 10:57am UTC](https://www.ruby-forum.com/t/where-assign-values-to-rrp-peers-last-cached/222515/2 "2012-08-31T10:57:45Z")

</div>

Hello!

On Fri, Aug 31, 2012 at 03:27:13AM -0400, lenky0401 wrote:

> ```
> if (rrp->peers->last_cached) { ==============>//never be true?
> c->write->lock = c->write->own_lock;
> 
> ```
> 
> this? Thank you in advance.  
> This code is lefover from earlier incomplete attempts to implement  
> cached connections. It’s not currently used.

Maxim D.
