cache duration does not work in memcache

[font="Times New Roman"][size="3"]Hi[/size][/font]

[font="Times New Roman"][size="3"]I write below code in one actionController for caching query of database in memcached:[/size][/font]

[font=“Times New Roman”][size=“3”][color="#ff0000"]$key = ‘my_key’;[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] $post = \Yii::$app->cache->get($key);[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] if ($post === false) {[/color][/size][/font]

[font=“Times New Roman”][size=“3”][color="#ff0000"] $post =\backend\models\Post::find()->where([‘id’=>3])->one();[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] \Yii::$app->cache->set($key, $post,5); // time in seconds to store cache[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] echo "data not in cache";[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] }[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] else[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] {[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] echo "<pre>";[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] print_r($post);[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] echo "data in cache";[/color][/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"] }[/color][/size][/font]

[font="Times New Roman"][size="3"]The cache work correctly,but the cache duration is not work correct(after 5 second cache in not deleted).[/size][/font]

[font="Times New Roman"][size="3"]Please help me?[/size][/font]

[font="Times New Roman"][size="3"]My problem is solve.[/size][/font][size=2]I to to Ubuntu terminal and write below command:[/size]

[font="Times New Roman"][size="3"][color="#ff0000"]nano/etc/memcached.conf[/color][/size][/font]

[font="Times New Roman"][size="3"]Then,I change [color="#ff0000"]-l 127.0.0.1[/color] to [color="#ff0000"]-l 192.168.1.4[/color] that 192.168.1.4 is IP address of my Ubuntu vmware.[/size][/font]

[font="Times New Roman"][size="3"]Then I write below command:[/size][/font]

[font="Times New Roman"][size="3"][color="#ff0000"]servicememcached restart[/color][/size][/font]

[size=2]

[/size]