# Changing Media Caching Logic

**URL:** <https://community.wowza.com/t/changing-media-caching-logic/43435>\
**Category:** Wowza Streaming Engine\
**Created:** [July 23, 2014, 4:43am UTC](https://community.wowza.com/t/changing-media-caching-logic/43435 "2014-07-23T04:43:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arda\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Arda\_Kaplan](https://community.wowza.com/u/Arda_Kaplan)\
**Post date:** [July 23, 2014, 4:43am UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/1 "2014-07-23T04:43:37Z")

</div>

Hi Wowza,

I’ ve already downloaded Wowza Media Server 4.0.4 and Eclipse Plugin. By using these, i wrote some codes for changing logic of media caching. But i could not make it right.

I think, it is not possible to this version, ha ?

I found a link “[https://www.wowza.com/form/addons-request](https://www.wowza.com/form/addons-request)” that mentioned to me , for this king of changing requires different app, i think. Or i understand wrong?

I want to change media caching logic by writing some code in eclipse and importing these codes. So is there an way to make this ? Or it is impossible?

I read this link “[https://www.wowza.com/docs/how-to-scale-video-on-demand-streaming-with-media-cache](https://www.wowza.com/docs/how-to-scale-video-on-demand-streaming-with-media-cache)” , but i couldn’t find what i am looking for.

If it is possible, can you give me a little bit explation or link or sample codes.

Thanks from now,

Arda

---

<div class="post-metadata">

**Author:** ![Paul\_Shields](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/paul_shields/32/390_2.png) [@Paul\_Shields](https://community.wowza.com/u/Paul_Shields)\
**Post date:** [July 23, 2014, 1:26pm UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/2 "2014-07-23T13:26:57Z")

</div>

Hi Arda,

Can you describe in more detail what you are trying to achieve?

Regards,

Paul

---

<div class="post-metadata">

**Author:** ![Zoran](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/zoran/32/385_2.png) [@Zoran](https://community.wowza.com/u/Zoran)\
**Post date:** [July 24, 2014, 5:54pm UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/3 "2014-07-24T17:54:54Z")

</div>

Hi,

You can use the normal RAM in main memory as if it were a partition on a hard drive, and then use that partition as the Media Store location for caching your media files.

Take a look at this web article explaining how you can do that:

[http://www.cyberciti.biz/faq/howto-create-linux-ram-disk-filesystem/](http://www.cyberciti.biz/faq/howto-create-linux-ram-disk-filesystem/)

Zoran

---

<div class="post-metadata">

**Author:** ![Andrew\_Kennedy1](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@Andrew\_Kennedy1](https://community.wowza.com/u/Andrew_Kennedy1)\
**Post date:** [July 24, 2014, 5:21am UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/4 "2014-07-24T05:21:57Z")

</div>

Hi,

This is effectively how MediaCache works by changing the MinTimeToLive value. This value is the minimum time an asset can stay in the store when not in use.

Scenario

Store is 10Gb

The following files are cached 5 minutes apart with a MinTimeToLive set to 300000 ( 5 minutes )

File 1 is requested and partially cached - 2Gb - After 5 minutes the user stops watching the file

File 2 is requested and partially cached - 2Gb

File 3 is requested and partially cached - 3Gb

File 4 is requested and partially cached - 2Gb

File 5 is requested - 2 Gb - However only 1 Gb of space remains. MediaCache knows the MinTimeToLive has expired on File1, so removes it to make space for File 5. When a file is requested MediaCache reserves the whole file size, rather than just the amount being used at the time so it knows it has space to populate the rest of the cache with the file when needed.

This is a very simplistic example but hopefully clarifies it for you.

Andrew.

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [July 24, 2014, 9:52am UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/5 "2014-07-24T09:52:37Z")

</div>

Hello Arda

The cache is stored on disk. You can review setup information [here](https://www.wowza.com/docs/how-to-scale-video-on-demand-streaming-with-media-cache).

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Arda\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Arda\_Kaplan](https://community.wowza.com/u/Arda_Kaplan)\
**Post date:** [July 24, 2014, 3:01am UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/6 "2014-07-24T03:01:27Z")

</div>

Hi Paul,

Ok, I try to explain;

My data class basicly like this;

class item {// class that hold the video data

stream //stream

LTD // last download time

counter // number of watching

}

If a new video is asked to add to cache; if cache is available ( has free part) it is added without logic.

But if cache has no free part, it must change the videos. And this logic looks for LTD , it chooses minimum LTD and removes the minimum LTD video. Than it adds newly requested video to this free part.

My codes basicly like this, but i dont/cant apply to wowza server. And i couldnt find any source about coding media caching.

I hope i made my point clear.

Have a nice day

Arda

---

<div class="post-metadata">

**Author:** ![Arda\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Arda\_Kaplan](https://community.wowza.com/u/Arda_Kaplan)\
**Post date:** [July 24, 2014, 6:35am UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/7 "2014-07-24T06:35:38Z")

</div>

Hi again and thanks for solution

Is it file caching, right ? Maybe, it is my fault. I did not give any key world, but i need ram caching. Does this setting set up for ram caching?

Have a nice day

Arda

---

<div class="post-metadata">

**Author:** ![Arda\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@Arda\_Kaplan](https://community.wowza.com/u/Arda_Kaplan)\
**Post date:** [July 24, 2014, 11:27pm UTC](https://community.wowza.com/t/changing-media-caching-logic/43435/8 "2014-07-24T23:27:00Z")

</div>

Thank you Zoran and Matt =)

I will try .

Arda
