Does SSRS Cache report generate a new cache automatically after expiration? - caching

When you cache a report in SSRS 2008 and set it to expire after a number of minutes, for example 30 minutes, Does the report refresh after it expires and generate a new cached report automatically or it refreshes only when the report is requested or run?
For example, if I run the report at 10:00AM, it will expire at 10:30AM, then when someone else runs the report at 11:15AM, Will there have been a new Cached report or it will be processed as new(in other words, it is not based on a Cached report)?
Thanks!

According to the documentation, the default behavior is that an expired cache is not refreshed until the report is accessed.
http://technet.microsoft.com/en-us/library/ms155927.aspx
However, a cache refresh plan can be used to periodically refresh the cache according to a schedule.
This is less useful for parameterized reports where the parameters are changed frequently.
Edit: See here for more info. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/d7e8c6c8-2331-476f-b03e-f558458fa283/snapshots-vs-cached-instances?forum=sqlreportingservices

Related

"New version available" with service worker and sw-precache

I'm trying to use sw-precache, but I must be doing something wrong!
I'm mostly using the demo code available from the github repo and can't seem to get updates to the app to come through. Once it's cached the first time, it never checks for new versions.
I was expecting that when I publish a new service worker, the browser would request the new service worker and update the cache accordingly in the background. Then using the registration code in the example, I would be able to prompt the user to refresh and get the latest version from their newly refreshed cache.
Would really appreciate if someone could please point me in the right direction.
Example
To demonstrate the problem, I've created an isolated example here:
https://github.com/stevenocchipinti/sw-precache-demo
The example uses a basic skeleton from create-react-app which has a built in build task which take care of fingerprinting the filenames, etc.
I suspect the problem is with me caching everything by using the following sw-precache config:
{
"staticFileGlobs": [ "build/**/*.*" ],
"stripPrefix": "build/"
}
There are more accurate steps in the repo's readme, but the basic steps I'm taking to reproduce the problem are as follows (with my probably incorrect expectations).
Steps and Assumptions
Browse to the app for the first
I should see Content is now available offline! in the console
Reload the page
The message in the console should not appear again because the service worker is installed, but the page should still work.
Go offline and reload the page
The page should still work
Make a visible change to the source code
Rebuild (run the build task and sw-precache)
This is where my understanding must be wrong
Reload the page
The service worker should update the cache in the background
When its done, you should see New or updated content is available. in the console
The actual visible changes should not be visible until the next reload
Reload the page again
The browser will use the new cache this time around
The changes should be visible now!
There shouldn't be any messages in the console
The problem
Once the app has been cached initially, it will never update unless you unregister the service worker or force a reload.
I'm not sure how to make this work - any help would be greatly appreciated!
After replicating your development hosting environment, I can see that you're serving your service-worker.js file with a browser HTTP cache lifetime of one hour:
There's more information as to why this is leading to the behavior you're seeing, along with best practices, in this previous answer. As mentioned at the top of that answer, browsers plan on changing their behavior to stop honoring the HTTP cache for the service worker file by default, mainly due to the type of confusion that you're experiencing here. For the time being, though, the production versions of both Chrome and Firefox continue to honor those headers.

CodeIgniter - execute function when session expires

I'd like to update my own database when session expires. To do this I modified CodeIgniter's Session file and wrote my own code in sess_destroy(). Everytime the user logouts, sess_destroy() is called. It works correctly as my database gets updated. My problem though is that my database doesn't update when session expires. To test it, I set the sess_expiration in the config.php file to 20 seconds so I wouldn't have to wait long for it to expire. After it does expire, login details that are supposed to be displayed are gone, meaning the session is gone. My database, however, was not updated at all. I've tried inputting code in unset_userdata() and sess_gc() but database still doesn't update.
Suggestions are welcome. Thank you
The only way would be to call some sort of cron job to regularly scan the database of sessions for expired sessions and purge them or log them etc. Nothing is going to trigger that automatically.

Session.Timeout not working correctly in ASP Classic / IIS

Recently I created a asp classic web page with which a user can insert his worked hours.
One of the requests was that the page should show a message who is logged in every 10 minutes. The user does his production on a machine and has it's computer besides him, so it is possible that a user will be inactive on the hour web page for 5 - 60 minutes (or even more), yet he will stay on the page nonetheless.
To make the pop up message every 10 minutes I used a timer created in JQuery, this all works fine. Because the total inactive time is not sure, the person wanted the session timeout to be large (24-hours) so that session state (who is logged in) remains for a long time. When a user uses the insert hour web page he is requested to select his username on a different web page and the session("user") is then set.
To accomplish the long session timeout I created a global.asa file in the root with the following code:
<script language="VBScript" runat="Server">
<!-- METADATA
TYPE="typelib"
UUID="00000200-0000-0010-8000-00AA006D2EA4"
-->
Sub Session_OnStart
' Session timeout in minutes (24 hours)
Session.Timeout = 1420
End Sub
</SCRIPT>
Though for some reason (I timed it) the timeout is still the default 20 minutes.. Then I tried to also set the Session.Timeout = 1420 in:
a. The web page of the hours inserting and
b. In the page where the user is selected and the session is being set.
This didn't had any effect though. So then I started researching it and found a similar question on stackoverflow: Session Timeout in Classic ASP website
So this made me look at my IIS settings on the server where I changed a few things.
In the application pool of the website I changed the Regular Time Interval to 0:
Next I also changed the Time-Out to 24 hours in the Session Properties on the Services tab of my website (under Sites):
However this all doesn't have any effect. It still ends the session after 20 minutes (at least it resets my session("user") state.
In the hour inserting web page the session is being checked as follows:
if session("user")="" then
response.redirect("ShowPage.asp?page=SelectUserTimeout")
response.end
end if
So when the session is empty it will redirect to the select a user page where the session("user") will be set again. Though with my time-out settings, if it would actually work, this should only happen after 24 hours and not after 20 minutes.
Any ideas what's going wrong here?
I am using by the way IIS 8.0.
UPDATE
I found the problem! It seems that the Idle Time-Out (Minutes) in the Application Pool of my website was still on the default 20 minutes and for some reason my session.timeout in the asp code didn't override that.
So for anyone facing the same problem I suggest that you go to your Application Pools in IIS --> then go to the application Pool of the website --> go to advanced settings --> Process Model --> and change Idle Time-out
I found the problem myself! It seems that the Idle Time-Out (Minutes) in the Application Pool of my website was still on the default 20 minutes and for some reason my session.timeout in the asp code didn't override that.
So for anyone facing the same problem I suggest that you go to your Application Pools in IIS --> then go to the application Pool of the website --> go to advanced settings --> Process Model --> and change Idle Time-out
In fact the answer posted by the OP is not the solution. I had the same problem and solved configuring the application pool:
Basic Configuration - DO NOT USE .NET CLR. Select No Managed Code.
Pipeline code still Integrated.
Tried on Windows 10 Pro and Windows 2008 server and worked for both.

SSRS Report Does Not Refresh Via URL Access

I want to display the output of an SSRS report in an IFrame of another application. I set the source to something like this:
http://SERVERNAME.domain.com/ReportServer?%2fTBI_MSCRM%2fCustomReports%2f%7bdafdbed0-1e96-e211-a5da-001d0967e0fc%7d&rs:Command=Render&rc:Toolbar=false
The issue I am running into is that the output of the report seems to be cached for the session.
If there is a timestamp on the report that does not get updated when the page is refreshed. To see the updated data, you have to close out all browser and reopen the page. In SSRS, snapshots are not turned on, there is no cache refresh plan as the "Do not cache temporary copies of this report" option is selected.
I have take the URL out of the IFrame and run it in isolation and I get the same results, so it isn't the IFrame causing the problem. What I need is this report to refresh every time the URL is accessed.
Any ideas are much appreciated.
You can force the report server to get a new report in every request by clearing the session.
Just add the following to the URL rs:ClearSession=true
It would be implemented in your URL like that:
http://SERVERNAME.domain.com/ReportServer?%2fTBI_MSCRM%2fCustomReports%2f%7bdafdbed0-1e96-
e211-a5da-001d0967e0fc%7d&rs:Command=Render
&rs:ClearSession=true&rc:Toolbar=false
Clear session:
A value of true directs the report server to remove a report from the
report session. All report instances associated with an authenticated
user are removed from the report session. (A report instance is
defined as the same report run multiple times with different report
parameter values.) The default value is false.
for more information look here

Keep Accounts Logged In

We have an internal control panel that all employees in the office are logged into all day, including customer service. I'd like for it to be setup so that it keeps you logged in for 1 hour before your session expires. How can I change this in the PHP.ini? I made a change before I understood would keep the session open until the browser window was closed but it didn't stick.
There are two different values you can set:
session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up.
and session.cookie_lifetime which is how long the cookie will last.
http://www.php.net/manual/en/session.configuration.php
both values can be set in the php.ini file, but might get overriden in .htaccess files or in your scripts using ini_set.
You can also do this client-side using JavaScript. Use an AJAX call to periodically 'check-in' with the server, keeping the PHP session alive. You can also monitor if the user is doing anything on the current page, show them a '2 minute warning' message, or even redirect them to a 'session terminated' page when the 1 hour inactivity period is reached. You could even use this to 'force' a user to be signed out.
This isn't as secure as doing it purely in PHP, but does give you more flexibility to build cool features.
The most secure place to implement this would be in your application. You can store the session update time in $_SESSION on each page load. Before you update it, you check if it has exceeded the 60 minute limit, in which case you can use session_destroy() to terminate the session, followed by a redirect to the login page (or similar).
I don't think this can be done from the php.ini file. I think you either want to store the login time on the server and compare that with the current time and delete if 60mins have passed, or alternatively, use cookies -- these can have an explicit lifespan. See this for more information on cookies.

Resources