Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

apc_store(3) [php man page]

APC_STORE(3)								 1							      APC_STORE(3)

apc_store - Cache a variable in the data store

SYNOPSIS
bool apc_store (string $key, mixed $var, [int $ttl]) DESCRIPTION
array apc_store (array $values, [mixed $unused = NULL], [int $ttl]) Cache a variable in the data store. Note Unlike many other mechanisms in PHP, variables stored using apc_store(3) will persist between requests (until the value is removed from the cache). PARAMETERS
o $key - Store the variable using this name. $keys are cache-unique, so storing a second value with the same $key will overwrite the original value. o $var - The variable to store o $ttl - Time To Live; store $var in the cache for $ttl seconds. After the $ttl has passed, the stored variable will be expunged from the cache (on the next request). If no $ttl is supplied (or if the $ttl is 0), the value will persist until it is removed from the cache manually, or otherwise fails to exist in the cache (clear, restart, etc.). o $values - Names in key, variables in value. RETURN VALUES
Returns TRUE on success or FALSE on failure. Second syntax returns array with error keys. EXAMPLES
Example #1 A apc_store(3) example <?php $bar = 'BAR'; apc_store('foo', $bar); var_dump(apc_fetch('foo')); ?> The above example will output: string(3) "BAR" SEE ALSO
apc_add(3), apc_fetch(3), apc_delete(3). PHP Documentation Group APC_STORE(3)

Check Out this Related Man Page

APC_CAS(3)								 1								APC_CAS(3)

apc_cas - Updates an old value with a new value

SYNOPSIS
bool apc_cas (string $key, int $old, int $new) DESCRIPTION
apc_cas(3) updates an already existing integer value if the $old parameter matches the currently stored value with the value of the $new parameter. PARAMETERS
o $key - The key of the value being updated. o $old - The old value (the value currently stored). o $new - The new value to update to. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 apc_cas(3) example <?php apc_store('foobar', 2); echo '$foobar = 2', PHP_EOL; echo '$foobar == 1 ? 2 : 1 = ', (apc_cas('foobar', 1, 2) ? 'ok' : 'fail'), PHP_EOL; echo '$foobar == 2 ? 1 : 2 = ', (apc_cas('foobar', 2, 1) ? 'ok' : 'fail'), PHP_EOL; echo '$foobar = ', apc_fetch('foobar'), PHP_EOL; echo '$f__bar == 1 ? 2 : 1 = ', (apc_cas('f__bar', 1, 2) ? 'ok' : 'fail'), PHP_EOL; apc_store('perfection', 'xyz'); echo '$perfection == 2 ? 1 : 2 = ', (apc_cas('perfection', 2, 1) ? 'ok' : 'epic fail'), PHP_EOL; echo '$foobar = ', apc_fetch('foobar'), PHP_EOL; ?> The above example will output something similar to: $foobar = 2 $foobar == 1 ? 2 : 1 = fail $foobar == 2 ? 1 : 2 = ok $foobar = 1 $f__bar == 1 ? 2 : 1 = fail $perfection == 2 ? 1 : 2 = epic fail $foobar = 1 SEE ALSO
apc_dec(3), apc_store(3). PHP Documentation Group APC_CAS(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Storing the output into a variable

Hi unix gurus, I am trying to store the result of a command into a variable. But it is not getting stored. x='hello' y=echo $x | wc -c but it is giving the output as 0(zero) Pls help me its very urgent (7 Replies)
Discussion started by: ravi raj kumar
7 Replies

2. Shell Programming and Scripting

Please help

I want to write one script which split one stirng and store two splited portion in different variable. Exmp: string is S070528A Split it Into S070528 and A and store it into two variables. like fiirstname=S070528 lastname=A (2 Replies)
Discussion started by: rinku
2 Replies

3. Shell Programming and Scripting

affect variable

hi , i want to store variable but i get always error when i excute this command ligne : var = awk '{print $1}' file1 echo $var how can i store the var? thanks (7 Replies)
Discussion started by: kamel.seg
7 Replies

4. UNIX for Dummies Questions & Answers

How to store the values in a file into an array

Hi, I do have a file and the contents are as follws: 10 20 30 40 50 Now I want to store those values into an array. How can be done this ?? (3 Replies)
Discussion started by: risshanth
3 Replies

5. Linux

How to store values into variable in perl

Hi, Can you please help me of how to store the values into variables. Here is the output in LINUX for the below command. $free output : total used free Mem: 3079276 3059328 19948 Swap: 1023992 6324 1017668 ... (3 Replies)
Discussion started by: chittiprasad15
3 Replies

6. Shell Programming and Scripting

Please help: Build a sed command and execute it in a script

I am using an array to store some data (keys e.g 47975081_1215781266128), it can be assumed that it is key to other data. I want extract data from a file based on a couple of keys (range) and store the resulting data in a variable using the following command: sed -n... (9 Replies)
Discussion started by: gugs
9 Replies

7. Shell Programming and Scripting

store key value

Hi All, I have a string like echo $var D_PROC=20080723 I_REPROC=N C_TYPE_FILE=INBOUND Now I want it be stored in an associative array so that when we echo $arr it should be 20080723 (5 Replies)
Discussion started by: thana
5 Replies

8. Shell Programming and Scripting

Confusing me......!!!!!!

Hiii... There... I am making a Script in which I am taking the value of a variable "var" through key board. But I want, if no values are supplied for "var" for more than 5 seconds then script shuld automatically exit.Script is as follow : #cat abc #!/bin/bash echo "Enter Your Choice : "... (4 Replies)
Discussion started by: prashantshukla
4 Replies

9. Shell Programming and Scripting

Reading data from file and assigning to variable

I was trying to store the number of lines in a file and store it in a file.after that i want to store the information in a file to a variable which is further used in the if loop to check certain condition. #!/bin/bash cat <file> | wc -l > count.txt x="$count.txt"; i=10; if ; then cat... (10 Replies)
Discussion started by: sudhakaryadav
10 Replies

10. Shell Programming and Scripting

Unable to store "-e" in variable ??????

p="-e" echo $p It is not returning the value "-e" stored. Instead returns null. I am wondering how could this happen. Please help me out.I tried all possibilities like p='-e' | p="\-e". Nothing seems to work. :confused::confused: (10 Replies)
Discussion started by: shanneykar
10 Replies

11. UNIX for Dummies Questions & Answers

storing strings in C

i'm trying to figure out how to store strings into an array, can someone help me figure it out? i would like to store the following for example: array = "dog" array = "cat" the inputs are coming from the command line. Thanks, (6 Replies)
Discussion started by: l flipboi l
6 Replies

12. Shell Programming and Scripting

How to store files names from a directory to an array

Hi I want to store the file names into an array. I have written like this but I am getting error. declare -A arr_Filenames ls -l *.log | set -A arr_Filenames $(awk '{print $9}') index=0 while (( $index < ${#arr_Filenames })); do Current_Filename=${arr_Filenames} ... (5 Replies)
Discussion started by: dgmm
5 Replies

13. Shell Programming and Scripting

Storing lines of a file in a variable

i want to store the output of 'tail -5000 file' to a variable. If i want to access the contents of that variable, it becomes kinda difficult because when the data is stored in the variable, everything is mushed together. you dont know where a line begins or ends. so my question is, how can i... (3 Replies)
Discussion started by: SkySmart
3 Replies

14. Shell Programming and Scripting

How to read values and store in array?

I am reading a value from a file and want to store the value in a dynamic array as i don't know the number of occurrences of the value in that file. How can i do that and then later fetch that value from array (25 Replies)
Discussion started by: Prachi Gupta
25 Replies

15. Shell Programming and Scripting

GawkING Data from Ping

I am trying to cut out the "time" in the ttl field from: 64 bytes from 4.2.2.5: icmp_seq=1 ttl=54 time=26.2 ms 64 bytes from 4.2.2.5: icmp_seq=2 ttl=54 time=20.5 ms 64 bytes from 4.2.2.5: icmp_seq=3 ttl=54 time=26.5 ms 64 bytes from 4.2.2.5: icmp_seq=4 ttl=54 time=29.8 ms ^C and am having... (2 Replies)
Discussion started by: metallica1973
2 Replies